docs/wiki/Diagnosing-Project-System-Build-Errors.md
When you open a C# or VB.NET project in Visual Studio, Visual Studio needs to interpret your project file to understand the compiler settings and references you have. In most cases, this is easy, but if you've manually customized your project files, or are consuming additional SDKs or NuGet packages, things can sometimes go wrong. This will help you debug the cause of what went wrong.
There are a few ways to tell:
A Microsoft engineer asked you to follow these steps.
In any version of Visual Studio, look to see if the first project drop down above a text file says "Miscellaneous Files" instead of the name of the project you expected to see:
If you're using Visual Studio 2015 Update 2 or later, look for warning IDE0006 in the error list:
Go under the View menu, choose Other Windows, and then Command Window.
The Command Window opens up. In it, type Project.LogRoslynWorkspaceStructure:
Press enter. A prompt will appear asking you to save an XML file. This will prompt to save an XML file, and the process may take some time. Attach this item privately to your problem report if you have one.
Close Visual Studio.
Find your solution file on disk, and delete the .vs hidden folder that is alongside your solution.
Run a "developer command prompt". The easiest way to find it is just to search in the start menu:
Type set TRACEDESIGNTIME=true in this prompt.
Type devenv to run Visual Studio again from this prompt.
Open your solution.
Now, open your %TEMP% directory, which should be at a path like C:\Users\<username>\AppData\Local\Temp. In this
you'll see a bunch of files that end in .designtime.log.
If you are running Visual Studio 2015 Update 2 or later, the files start with the name of a project in your solution,
then an underscore, and then the name of the underlying build target being invoked by Visual Studio. Look for the
files named YourProject_Compile_#####.designtime.log, where ##### is just a random identifier generated to keep the
log files unique. Look for log files with "Compile" in the name.
If you're running Visual Studio 2015 Update 1 or sooner, it's a bit trickier. The files are just named with random GUIDs, but still end in .designtime.log. If you open a log file, you'll see first a section showing variables, and then a line like this:
Project "c:\Projects\ConsoleApplication53\ConsoleApplication53\ConsoleApplication53.csproj" (Compile target(s)):
This shows the full name of the project, along with the target (Compile) being run. Once again, look for the "Compile" target. There are files with other targets being invoked, you'll want to ignore those. You might want to consider using Visual Studio's "find in files" feature to find the right file.
Once you've found the right log file for your project, scroll to the very end and verify there was an error. You should see something like this:
Build FAILED.
c:\ConsoleApplication53\ConsoleApplication53\ConsoleApplication53.csproj(17,5): error : An error occurred!
0 Warning(s)
1 Error(s)
Notably, you should see Build FAILED and then one or more errors. This is a summary of the errors in the log, so if you
do see an error, you should now search this log file for that error and find out where it is. Hopefully, the error will
give some sort of a hint; it's looking for some file or SDK that's not installed, or some permissions were denied, etc.
In that case, you can follow up with the owner of that to figure out what went wrong.
If it seems to be a problem with Visual Studio itself, you might want to file a bug on the Roslyn GitHub project to have a Visual Studio engineer take a look. Make sure you provide the full log and if possible your project file, since we may need both to diagnose the problem.