27

The only strange thing is a warning on the projects, but without any indication of what it is:

enter image description here

enter image description here

enter image description here

Any ideas?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jcintra
  • 747
  • 1
  • 7
  • 8
  • 3
    Do you see any warnings in the Errors panel? What happens if you compile your project from the command line? Run `dotnet build -c Release` inside your project folder. – silkfire Dec 11 '21 at 14:28
  • Try to clean your solution `right click on solution > Clean solution` the try to rebuild it should an error message appears in error panel – Ibram Reda Dec 11 '21 at 14:42
  • 2
    Clean the solution didn't help, but after building from the command line I found the error. A missing reference in a partial view. Thanks for the help. – jcintra Dec 11 '21 at 18:08
  • 6
    Two suggestions. 1. From the VS IDE's Tools|Options dialog, select the "Projects and Solutions \ Build and Run" properties page and set the MSBuild output and log verbosity to "Diagnostic" (the last 2 combos on that settings page). 2. Build your solution from the command line using msbuild /bl , and then analyze the results in using the MSBuild Structured Log Viewer (msbuildlog.com) – Ed Dore Dec 13 '21 at 23:06
  • i use suggestion one to see the errors in the MSBuild and i found errors in the views, thank you Ed Dore – sultan s. alfaifi Jan 04 '22 at 09:58
  • this happened to me, I changed the Configuration to Release, then changed it back to Debug and all the errors disappeared. This might have been a coincidence. – seFausto Jul 24 '22 at 16:59

6 Answers6

83

On error view, Change Show issues generated to "Build Only"

Change Show issues generated

memtrk
  • 831
  • 2
  • 3
  • 6
    This quick and easy fix made my day! Fantastic! – Jess Rod Jan 20 '22 at 14:52
  • 4
    This seems like a workaround for bug in the IDE rather than an actual fix. It works, but it doesn't actually fix the problem. – computercarguy Jun 01 '22 at 19:24
  • 2
    How is it possible that Razor compilation gets worse with each VS release? Anyone else noticing that? Are they trying to send us the message to move to React or Blazor? I prefer straightforward communication rather than passive aggressively just making the software more frustrating and terrible. Your mileage may vary. – tnk479 Jun 14 '22 at 14:25
  • As others said, this works but the issue remains as a bug in VS. Blazor projects have the exact same problem given their use of Razor. – Cody J. Mathis Jun 26 '22 at 07:22
  • Thank you so much. You saved a lot of my time. Thanks again. This worked for me like magic. – Karishma Oct 03 '22 at 10:16
  • I've had this issue and I believe I resolved it by finding and deleting a `.sln.metaproj` that someone had checked into source control. – Stuart Mar 08 '23 at 16:27
2

If you have multiple projects under same solution make sure the Target Framework (Right click project -> properties) of each project is feasible for the referencing project. I was trying to refer to a project (v4.8) from v4.6 and encountered this error.

And also try checking the build order of the project (Right click solution -> Project Build Order) and clean and build each projects according to that order.

Ishan
  • 285
  • 2
  • 8
1

If you have Symantec Antivirus running on your machine, it could block MSBuild.exe from Visual Studio resulting in the build failing.

You may re-install/ reconfigure Symantec to allow MSBuild.exe.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Neeraj Aug 26 '22 at 06:16
1

Open Visual Studio Installer, click Modify on the version that's not working, select the Individual Components tab, untick Intellicode and click Modify (bottom right).

Once it's finished, go through the same process but tick it this time, restart VS (which you have to do anyway).

DavidWainwright
  • 2,895
  • 1
  • 27
  • 30
0

Go to location of the project, delete .vs folder and re-build again.

Adeel Ahmed
  • 147
  • 9
0

open your terminal and run using shift +`` key in visual studio. Run dotnet run all errors will be shown on terminal

Bob Sarfo
  • 19
  • 2