What is the default location for MSBuild logs?

后端 未结 4 486
予麋鹿
予麋鹿 2020-12-08 08:50

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 .l

4条回答
  •  失恋的感觉
    2020-12-08 09:38

    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.

提交回复
热议问题