Here's a collection of popular answers. Upvote the OP of the answer if it helped you:
Option 1: Clean, Build and Refresh (@Mike Fuchs option)
As @Mike Fuchs mentioned, try the following operations:
In menu, Build > Clean Solution
And
In menu, Build > Build Solution
and select the project in question, and click on the refresh button:
Option 2: Clean, Close, Restart and Build (@Pixel option)
As @Pixel mentioned, try the following sequence of operations:
- Clean the solution
- Close Visual Studio
- Open Visual Studio
- Build solution
Option 3: Clear ReSharper cache (@GammaOmega option)
If you have ReSharper, try emptying the ReSharper cache:
In menu, ReSharper > Options > Environment > General > Clear Caches
and disabling and re-enabling ReSharper:
In menu, Tools > Options > ReSharper > General > Suspend / Restore
Option 4: Delete the .suo file (@Neolisk option)
As @Neolisk mentioned, deleting the .suo file might solve your problem. For Visual Studio 2015, the file is located in:
[Path of Solution]/.vs/[Solution Name]/v14/.suo
And for Visual Studio 2017:
[Path of Solution]/.vs/[Solution Name]/v15/.suo
Note that the .vs directory is hidden.
Option 5: Unload and Reload Project (@TTT option)
As @TTT mentioned, try unloading the project that causes problems:
In Solution Explorer, right-click on project, Unload Project.
And re-loading it
In Solution Explorer, right-click on project, Reload Project.
Option 6: Remove and add Microsoft.CSharp reference (@Guilherme option)
As @Guilherme mentioned, try removing and adding the reference to "Microsoft.CSharp" from the projects that have problems.
In Solution Explorer, expand the project, expand "References", right-click on "Microsoft.CSharp" and Remove.
Then, right-click on References > Add Reference, select "Microsoft.CSharp" from the list and click OK