SOLVED! For people who are having the same problem this is what i did:
I moved the project away from where Visual Studio though it would be. This forces you to create a new project file there. I did. Then i restarted the program and now my project was visible. I now just moved the original project-files into the now visible folder.
I added an project to my solution but it doesn't show up next to all the other imported projects.
And since it doesn't i'm unable to delete it and try again.
However it can be seen if i right click the solution and go to "Startup Project", "Project Dependencies" or "Debug Source File".
I have searched the web for a while now but have yet to find someone with a similar sutiation, how do i solve this?
I imagine that this is because the files don't exist. Have you created the project on a network drive somewhere? Have you renamed or moved the folder after adding it to the solution?
Check the paths are right, then double check. Also check your version control to ensure someone hasn't wiped out your changes and left the .sln file intact.
You can edit the .sln directly I suspect to double-check the exact path it's looking for. Verify that path exists too.
Make sure the project you added was created in the same version of Visual Studio too.
Related
I was working on a ASP.NET MVC project when, between two debugs, my main controller simply vanished from the project. I didn't delete or remove it, it's not in my trash folder, neither it's visible when "Show all files" is selected. Searched the whole computer and it's nowhere to be found.
Since it's not a very important project, only part of a training, there is no backup.
Is there anything that can be done to restore it? Has this happened to anyone else?
I am trying to add Microsoft.CSharp and other system references to a c# class library in vs 2015 community edition bound to tfs. when i add it doesn't persist the path for this particular class library. All the references i add are highlighted in yellow !. The same references and paths I am able to add to other projects but not this current one I am facing an issue with.
I have created a new solution and tried. it still doesn't work.
However I would not want to create a new project file. Any suggestions or workarounds to solve this problem?
Your .csproj files might be "corrupted" somehow. I would create a new project file and then overwrite your existing project file so that it can be checked into TFS.
Create a new project and copy all of your source files into the folder. If you have folders use Visual Studio to re-create them. Use the show hidden button in Solution Explorer to show all the files. Now include the files by right clicking and selecting include in project (you can use Shift to select multiple files). Check your project properties and make sure you copy anything important.
I tried a few things-
I changed from community edition to professional edition 2015. the same problem persisted.
I created a new csproj file and added back the files manually. It got added fine.
However I am pulling the references from a nuget packages folder and updating. if we have the wrong path to the nuget packages, even though we add the references, they were being shown as not referenced.
The nuget packages needed to be correctly mapped or else VS2K15 acts weird.
So bottom line, because my nuget references were incorrect it was throwing these errors. I know This is very weird!!!
I did a huge plunder and accidentally lost my *.cs (Design file).. I just got the *.designer file left.
Can I go the other way around and create somehow a Design-File (*.cs) only with the .designer file or do I have to start over?
Please have a look in Recycle Bin and click restore. So you will get your file back in visual studio solution explorer with excluded status. Right click and include in project.
To avoid this type situations, use version controls in your project like:
TFS - Team Foundation Server
GIT
Visual Source Safe
SVN
I'm trying to create a Monogame Project in Visual Studio 2012. Monogame itself is installed correctly, I've cloned one of my older projects from github and it compiles fine.
But if I create a new project in Visual Studio the .dll references are wrong. There is a build error that complains about not finding SDL.dll . There is the SDL.dll reference in my project outline and it indeed points to the wrong file:
This path "C:\Users\lhk\Program Files..." does not exist. Windows doesn't store Program files in its "Users" folder.
I opened the explorer and opened the very same path without "Users\lhk\" and the .dll is found.
Then I checked my older project again. The same SDL.dll is referenced in the Visual Studio solution but the path is the correct one. And the older project compiles just fine.
Somehow the Monogame Project template fills in the wrong paths.
Now here's the problem:
I can't edit that reference.
The text is greyed out and not editable and I didn't find the correct settings to change the reference.
Oh, the problem is solved:
I tried drag-and-drop with the dll.
So far Visal Studio always complained that there is an existing file with the same name.
I tried to "cut" the wrong .dll but that only made its icon slightly transparent. The new .dll still couldn't be added.
Turns out that the ENTF key can do what cutting can't.
I'm afraid I never got the idea that I could delete it with ENTF after cutting didn't work. Now its gone.
I dragged the new dll over to the project.
Compiles fine
Apparently you can just drag and drop references to a project.
At first I thought this wouldn't be possible because the wrong .dll just couldn't be deleted. I tried to "cut" it from the project but it just changed the color of its icon and persisted.
With the old .dll still intact the new one couldn't be added.
I'm afraid the solution is extremely simple. You can just remove this reference by pressing "ENTF" - it's rather embarrassing. But I never thought this would work after cutting had no effect.
With the old reference having been removed you can indeed drag and drop the new one.
The project compiles fine.
What I did is create a path on the drive and put the sdl.dll file there. So whenever I make a project Visual Studio finds it.
I have the following problem.
I made an application in C# (using Visual Studio 2010). Everything worked fine.
Then I had to make some changes in a "main.cs". Did those... all fine again.
Then I had to make other changes in same file. Did those... cleaned the solution built it. The problem is that when I run/debug/anything the application I get the same result as I did before I made the changes. I even tried to break the code (called a random function that didn't exist, used wrong syntax), but the result was the same "Build successful" and the old version.
Is there some kind of cacheing mechanism or something? How do I get rid of this problem?
I added prints for the "compile" solution... I can't find the build property.
Try deleting the bin and obj directories in the Visual Studio project directory. The obj directory contains the temporary files used to create the binary while the bin directory contains the binaries for that project. In addition, check if there are any warnings being shown when you build your solution.
I was able to reproduce the same error i.e. build successfully even though the file has not been compiled. The Build Action of the file had not been set to Compile.
The correct Build Action for a code file (main.cs) would be Compile.
According the updated question the file properties does not have the compile option
The reason for this is that the file (main.cs) has not been included in the project, but the "Show all files" button is "on" in the Solution Explorer. The file has not been included in the project (hence not compiled) and the file icon is greyed out in Solution Explorer.
To include this file in the project, right click on add existing item to the project (see following image). In the subsequent dialog select the file (main.cs) and click on the add button.
This should solve your problem.
In future, it is best to keep the "Show All Files" button as "off" to avoid confusion.
Is it possible you have selected the build and run last successful version? Check out my answer to something similar here. If the changes you made broke something and you had checked the boxes and hit yes to the dialog boxes in my answer below then that's most likely the issue.
Cannot see changes I make when I run my application in Visual Studio
Make a backup of your solution.
Delete the .cs files from within the solution explorer. If your program compiles and runs, than you are linked to source folders and not actually using the one in your solution.
I doubt this is it, but worth a try. The other things that came to mind you have already eliminated out with the previous answers.