Although it is true that VS does not allow this directly, you can still build using MSBuild "inside" VS2015 and get both the output of the build window and the log file as follows: (Perhaps this is a little hack.)
- In your VS Managed solution, add a new project (call it "Make"). but. The type of project you want is a Visual C ++ / NMake project.
- Identify the MSBuild commands you need on the command line (see below).
- Reconfigure the solution to create an NMake project instead of regular managed projects.
This will create a project with the Build, Rebuild, and Clean command line commands where you can directly execute MSBuild. For example:
Recover: 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
Clear: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Clean
You can also specify multiple command lines MSBuild.EXE to create multiple projects. For the usual result of building the whole solution, you can target only the final assemblies and allow the dependency graph to generate individual goals.
This will create a .log file, where NAME is the name of the NMake project you used. In the above example, 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 be done with the usual VS behavior, but you can build a complete solution inside VS and get build logs.
Brad Jul 16 '17 at 21:22 2017-07-16 21:22
source share