What is the default location for MSBuild logs?

Visual StudioMsbuildVisual Studio-2012

Visual Studio Problem Overview


I am using Visual Studio Express 2012. Where is the location of the log file? I have searched in the folder where my solution and projects are stored, but cannot find any .log file.

This is the configuration for logging:

enter image description here

Visual Studio Solutions


Solution 1 - Visual Studio

Log file from Visual Studio is only supported for C++ projects. You just have to work with the output window for others.

See this similar thread: VS2010: minimal build log in output and detailed log in log file

And in case you happen to do this for a C++ project, the file is at: > ... build log in the intermediate files directory > ... The path and name of the build log is represented by the MSBuild macro > expression, $(IntDir)\$(MSBuildProjectName).log.

Solution 2 - Visual Studio

Use build output instead of logging to file. Instead of copy/paste, simply click somewhere in the output and press CTRL + S to save. Visual Studio will prompt you for a location (tested with Visual Studio 2017, but I'm assuming this works in earlier versions too).

enter image description here

Solution 3 - Visual Studio

The msdn documentation is pretty clear about this (And you ain't gonna like it!):

https://msdn.microsoft.com/en-us/library/jj651643.aspx

Where it says:

> To create a build log file for a managed-code project On the menu bar, > choose Build, Build Solution. > > In the Output window, highlight the > information from the build, and then copy it to the Clipboard. > > Open a > text editor, such as Notepad, paste the information into the file, and > then save it.

Solution 4 - Visual Studio

While it's true that VS doesn't allow this directly, it is still possible to build with MSBuild "inside" VS2015 and get both the build window output and the log file, as follows: (Arguably this is a bit of a hack.)

  1. In your VS Managed solution, add a new project (Let's call it 'Make'). a. The project type you want is Visual C++/NMake project.
  2. Define the MSBuild commands you need on the command line (see below).
  3. Change the solution configuration to build the NMake project instead of the normal managed projects.

This will create a project that has Build, Rebuild, and Clean command lines where you can execute MSBuild directly. For example:

Rebuild: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Clean,Build

Build: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Build

Clean: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Clean

You can also specify multiple MSBuild.EXE command lines in order to build multiple projects. For the usual build-the-entire-solution outcome you can target only the final end assemblies and let the dependency graph generate the individual targets.

This will produce a .log file, where NAME is the name of the NMake project you used. In the example above, the log would be make.log.

A working example is available on GitHub: https://github.com/bitblitz/VS_MsbuildExample (Tested with VS2015)

Note that building individual projects directly will still build with the normal VS behavior, but you can build the full solution inside VS and get the build logs.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHanxueView Question on Stackoverflow
Solution 1 - Visual StudioDmitry PavlovView Answer on Stackoverflow
Solution 2 - Visual StudioDan Gøran LundeView Answer on Stackoverflow
Solution 3 - Visual StudioC JohnsonView Answer on Stackoverflow
Solution 4 - Visual StudioBradView Answer on Stackoverflow