I know there is another question with exact the same problem, but I went trough all those answers, and none helped me. :( (This was the question.)
I just created a new A
I had 2 files (and 2 classes) in the same project with the same name.
For me cleaning and building didn't work. Unloading the project didn't work. Restarting Visual Studio or even the pc didn't work. This is what did work:
Go to each of the projects that are throwing the error, and in References, delete the reference to the problematic project and add it again. That solves the issue.
The problem seems to be related to moving a project around (Move it inside a folder for example), then a different project that references it, have its path wrong and can't find it.
In my case I was facing same error. One of my project solution was referring an assembly from different NuGet location. I just changed it to correct location to solve this error and rebuild. and wow the project get build successfully and all other error gone away.
This issue happens when you renamed your solution and the .net framework cannot find the old solution.
To resolve this, you need to find and replace the old name of solution and all dependencies on it with the new name. If you need to browse the physical file through file explorer do so.
The files that are normally affected are AssemblyInfo.cs
, .sln
an Properties > Application > Assembly
name and Default namespace. Make sure to update them with the new name.
Open the file explorer, if the folder with the old name still exists, you need to delete it. Then clean and build the solution until the error is gone. (If needed clean and build the project one by one especially the affected project.)
In my case, there was an error, but it was not properly parsed out by VS and shown in the "Error List" window. To find it, you much view the ol "Output" from build window and parse through the messages starting from top down and resolve the actual error. M$, please fix! This is a huge waste of time of the worlds collective developers.
I had this issue with a solution containing multiple projects.
It came from duplicating a .csproj and adding the copy to the solution. A .csproj file contains a <ProjectGuid>
element. I set the GUID of the copied project to a new one.
Update: Which GUID you use doesn't matter, it just needs to be different from the other project's GUID. You can create a new GUID from within Visual Studio: Tools -> Create GUID
and copy the part between the curly brackets, i.e. {...}
. Use that as the new value for the <ProjectGuid>
element.
I also performed the following steps (not neccessarily neccessary, but they don't hurt):