VS 2013. Following on from my previous Q of not being able to edit a file without causing a crash Edit a cs file and the project wont build seems to be a csproj issue.
I have followed the instructions I found:
To edit a .csproj (or any other project file) directly from Visual Studio, do the following:
Right click the project in Solution Explorer
Select "Unload project"
Project is now unloaded
Right click the project again and select "Edit blah.csproj"
Make your changes and save them
Right click the project and select "Reload project" to apply the changes
However unload project is not available (please see image)
why is this?
I Have done a complete search of the folder and .csproj does not exist? How is this possible
Potential answer, at least for VS2022
Here's the Solution Explorer view of my current project (super-retro RogueLike console game in C#)
If I click on the top level of the solution explorer ("Solution 'RogueLike Tutorial' (1 of 1 project)"), I get the menu like you showed, with no Unload Project option:
But if I go one item lower in the menu, to "RogueLikeTutorial" (with the C# badge), I get the following menu, which is the one you were looking for:
No idea if that was the case almost 5 years ago in VS 2013, but finding your question and the comments helped me when I just ran into this issue in VS 2022. I hope this helps any future time travelers!
Related
I am working on vs code. When I open any folder the IntelliSense is not working when I hover the mouse over any text. It was working before but now I don't know why it's not working. Kindly help...
Solution 1 :
Ctrl+Shift+P
Write "OmniSharp: Select Project" and press Enter.
Choose the solution workspace entry.
Then enable the C# extension for "OmniSharp : Project"
Solution 2 :
Selecting a project.json-file is opening a DNX-project and VSCode will load that project plus the referenced projects.
Selecting a *.sln-file is opening a MSBuild-project. It will load the referenced *.csproj-projects and sibling or descendant project.json-files but no other project files that are referenced from the solution file.
Selecting a folder will make VSCode scan for *.sln and project.json files and VSCode will attempt to load them all.
More info see: https://github.com/OmniSharp/omnisharp-vscode/issues/1889
Solution 3:
Download C# v1.24.0 extension can fix the IntelliSense for you
Solution 4:
For bootstrap and HTML IntelliSense, add the following extensions:
HTML HTML CSS Support
IntelliSense for CSS class names in HTML
NOTE :
All solutions need to close your VS and reopen it again.
For me solution 2 worked.
C# IntelliSense did not work with C# Extension v1.25.0.
Solution involved:
Download the old version of C# Extension 1.24.4 vsix
Install vsix manually to VS Code:
Open VS Code.
Open the “Extensions” sidebar (you can use
“Ctrl+Shift+X”).
Click on the ellipsis icon in the top right corner
of the menu.
Select “Install from VSIX…” VS Code will open a
document browser.
VS Code will now begin the installation
process of the extension.
This happened to me on 2 separate machines
I have developed an C#, ASP.NET web application in a Windows 7 machine using Visual Studio 2012. Now i had imported the entire project into VS 2017 running on windows 10 machine, and when i try to enter the debugging mode to analyze my code it shows the following error:
I guess the project configurations are conflicting hence it throws this error.
Any suggestions??
The same error happens when Visual Studio solution has selected the wrong Startup Project. The bold project is the designated startup project.
Go to the Solution Explorer > Right click on the correct project and select "Set as StartUp Project" in the context menu.
I also got this error. I ultimately got to know that I was not selecting .sln file.
In VS, you should select .sln file and it automatically loads the complete project structrue is what I learnt.
Selecting .sln file worked for me
These errors are mostly because you are not selecting the .sln or solution file. In your solution explorer tree, double click the solution file and then build and run.
This runs contrary to a users intuition that simply opening a file and running it would work. Consider it a poor user interface. Jet Brains Rider, for instance, does not have this issue.
Change Targeting Platforms with the Configuration Manager and Build the project then try to debug it.I hope this will help you.
Don't export the project folder. upload the .sln file.
It will work.
DLLs cannot be ran/debugged directly. You have to specify host application in the
Configuration Properties>Debugging>Command and then let it load the DLL by itself.
You will most likely need to copy the DLL to the directory searchable by the host application e.g. its root or ./plugins folder.
In the Configuration Properties>Build Events>Post-Build Event>Command Line simply enter something like:
copy "$(TargetPath)" "$(HOST_APP)\plugins"
The Startup Item needs to be a .exe file. It's looking at BusinessLayer.dll because BusinessLayer is currently the Startup Project.
First, build the solution. Then, set the Solution Explorer to folder view and find the .exe in one of you project's /bin folders. Right click on it and set it to the Startup Item.
Finally, click the play button in Visual Studio top bar.
EDIT: Basically the same as Thomas' answer, but I'm pointing out that the "correct project" is the one with the .exe file. I would have commented on his answer, but I have less than 50 rep right now.
I am fairly new to C#..
I am using Visual Studio 12, the source I am using was last edited in VS 12.. But my problem is that it's throwing me this error:
First of all, my computer username isn't Martin, it is Administratoring - The creator of this project is Martin.. So that's where I guess it's coming from, but I don't know how to fix this.
I have tried editing in Project > Properties > Build > Output Path - And it still doesn't work. I am not too familiar with C#, and I've spent some time searching up for a solution but can't find it anywhere.. Probably because I don't know what I should be searching up (I've tried searching keywords and quotes from the error, but still nothing)
Try these:
Make sure that output path of project is correct (Project > Properties > Build > Output path)
Go in menu to Build > Configuration Manager, and check if your main/entry project has checked Build. If not, check it.
For those with this kind of problem - another solution:
Pay attention also to Warnings when you build solution. For example, I had referenced a dll built with higher version of .NET (4.5.2) than my main project (4.5)
After I referenced a dll built with 4.0 build process was successful.
Please try with the steps below:
Right click on the Visual Studio Project - Properties - Debug - (Start Action section) - select "Start project" radio button.
Right click on the Visual Studio Project - Properties - Debug - (Enable Debuggers section) - mark "Enable the Visual Studio hosting process"
Save changes Ctrl + Shift + S) and run the project again.
P.S. I experienced the same problem when I was playing with the options to redirect the console input / output to text file and have selected the option Properties - Debug - (Start Action section) - Start external program. When I moved the Solution to another location on my computer the problem occurred because it was searching for an absolute path to the executable file. Restoring the Visual Studio Project default settings (see above) fixed the problem. For your reference I am using Visual Studio 2013 Professional.
I had the same problem and unfortunately non of above answers worked for me . the solution that worked for me is :
right click on your startup project and select Properties - Debug and change "start external program: " to the correct path
Done!
Switch Target framework to 4.5.2 or something higher and bring it back to your original version (example: 4.5) then when you build, it will work.
You are not set the startup project so only this error occur. Mostly this problem occur when your working with more project in the single solution.
First right click on your project and "Set as Start Up Project" and/or right click on the start up file inside the selected project and click "Set StartUp File".
I also get this error quite often.
I solve this by modifying the code (doing a very small change), saving it, then building the solution again.
In my case I had added a project to a solution manually, where that project was targeting a higher .NET version than the rest of the projects that were referencing it. Strange... there would normally be a somewhat more verbose, literal and descriptive error in such cases.
There wasn't a real error but there was a warning that said as much.
Go to Project > properties > Debug Tab and set the Launch to "Project"
I had the same problems. I had to change file rights. Unmark "read only" in their properties.
So... it’s mid 2021 and I’m using visual Studio 2019 (version 16.10.2) which is the current version available, on a windows 10 pc.
I had to start a new project and following this steps solved the issue;
When at the menu that says “Create new project”
After you’ve selected your project template it takes you to another menu that says “Configure your new project”
On this menu there’s an option that says “Place solution and project in the same directory”.
By default this option was not checked, so I checked it and it solved the issue.
I had the same problem with visual studio 2015 , and I found that there is reference is marked so I just deleted it , maybe you can delete this reference or reinstall it again
What solved it for me was deleting the line
<ImplicitUsings>enable</ImplicitUsings>
from the project property file. It caused Visual Studio to generate a (useless) file with multiple global using directive.
I faced the same problem , but in my solution i had many projects so in the solution configuration the start up project was by mistake a class library i changed the startup project and then i worked like a charm
right click on the sln => common proprties => choose right startup project .
I have accidentally removed part of my project thinking that I was in a temp folder.
It is an asp.net-mvc 4 application.
I don´t have tfs or any other program monitoring my filesystem.
I had just publish my application. All I have left is a bunch of compiled files, js, css and images.
Is there any tool from Microsoft that I could perform a reverse engineering with or does VS2012 keep track of files so I could restore it.
Files you delete in Visual Studio go to Windows recycle bin. Unless you cleared it, your files should still be there. Just restore them and than add them to your project as existing items. You can also drag and drop them through Solution Explorer.
EDIT:
You can also click the "Show All Files" button in solution explorer.
The file will appear there, grayed out (if it was only removed from your project - not your disk drive). Then you can right-click it, and add it back to the ptoject. If it's not there try the first approach.
Open folder/solution of the deleted items in 'Windows File Explorer'
Press Ctrl+z (undo). This will instruct windows to undo the last actions on the folder
Go to the Visual Studio solution again
Click 'Show All files' icon on Solutions explorer
Click Refresh
Include the files again
PS. Its always safer to use a version control system, to make sure you can retrieve not just the file itself but any previously checked-in state. http://www.incredible-web.com/blog/revision-control-systems/
Try this:
Right click in your project;
click on "Open Folder in File Explorer";
open your project folder;
once the project folder is open just do a "ctrl + z".
Deleted files in visual studio should end up in the recycle bin if you have it enabled. If it has not been cleared out, you can restore it.
No file is really "deleted" when you delete it. It is usually marked as deleted but still can easily be restored by tools. One such tool is made by a company called AccessData that makes forensic investigation software called Forensic Toolkit. They have a program called FTK Imager which can create an image of a drive or folder and even show you deleted files which you can restore. This portion of their software is free. FTK Imager Download Maybe give it a try.
Lastly, learn to use subversion or other version control software (git, tfs) so this doesn't happen to you in the future and backup your stuff
Sorry i'm explaining in Visual Studio 2015, but options are same, just go through my steps.
Step 1: Open solution Explorer, right click on your project then Click on Open Folder In File Explorer.
Step 2: After open file Explorer Press "Ctrl+z" keys, this will have undo your deleted files.
Step 3: come back to visual studio, press refresh icon in solution explorer, you would have find your deleted files within dotted box.
enter image description here
Step 4: Right click on the Dotted file and select Option include in project.
enter image description here
that's it. now your deleted files are included in project.
Windows OS creates restore points when Windows Updates are applied. If you damaged a code module, like I did today, you might be able to right click on it from Windows Explorer and choose "Restore previous versions". The same option is available at the folder level.
Go to the Visual Studio solution
Click 'Show All files' icon on Solutions explorer
Click Refresh
Include the files again
and you can visit: Remove git mapping in Visual Studio 2015
There was only one project in the solution & I accidentally removed it. Good thing was I realized it on earlier stage & when I tried to close the solution, visual studio asked me to save the solution file. I said no & when i reloaded that solution, project was there.
Yeah, it is easy to restore.
Step 1: Go to recycle bin and restore the deleted items.
Step 2: In Visual Studio ,right click on the project and click add > Existing Items (Here you can add the deleted items)
On the top bar menu, select file then on the drop-down select Revert file
The deleted file will be restored.
Go to Source Contror in the left side of visual studio code editor and click on it , you will see the deleted files , mouse hover on file and click on Discard Change.
Your file will restore .
Just go to Recycle Bin and press the restore.you will find the deleted file in the file explorer in the software file.
Cannot Edit or Add Path to Reference File
, I cannot edit or add a path to a referece file. I have inherited a project at work. When I open the project and go to the references scetion in the Visual Studio 2010 IDE there are some little yellow warning signs showing that there is something amiss with the reference listed there.
But when I click on the item and look at the missing path, I find that the name "Path" is in grey suggesting that I cannot edit it and, sure enough, I cannot add the path name to the adjoining field. What causes this? I have the solution file and the project file checked out in edit mode.
When I open the project file, the error list also gives the warnings for each missing reference:
"The reference component '(the file name)' cound not be found"
Well, I know where they are but editing the path to point there is the problem.
I think in this situation you've got 2 choices:
Remove the broken references and re-add them to the project - this is easy to do if you don't have too many broken references.
Right click on the project file in Solution Explorer and select 'Edit Project File' and manually fix the reference hint paths (the project file is XML). Save, and right-click the project file in Solution Explorer again and select 'Reload Project'.
Editing the project file by hand found the problem.
THe project file is an xml file.
It did not take long to find a reference in the path that was wrong.
I had the same issue, none of the above solution worked. Only thing I was supposed to do was right click on my sln file, click on "Enable nuget package restore option", save it, close the visual studio. Open it again, clean and rebuild the solution. Visual studio rebuilt the solution successfully.
I also had a problem with adding references
i would add a reference and the path is always empty
what eventually helped was
Right click project > unload project
Right click again > Edit project file
in project file scroll to bottom and remove group named:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
....
</Target>
reload project again and build