VS2010: minimal build log in output and detailed l

2019-03-26 15:07发布

In Visual Studio 2010 we have under 'tools|options|projects and solutions|build and run' (couldn't find a correct image on the internet) two options for the logging of MSBuild:

'MSBuild project build output verbosity' and 'MSBuild project build log verbosity'.

So I was hoping to be able to get a minimal build log in the output view within Visual Studio devenv (correct) while at the same time a detailed build log in some log file.

I cannot find a way to configure a build log file to appear.

Note: I do not want to configure my own MSBuild.

2条回答
你好瞎i
2楼-- · 2019-03-26 15:44

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

查看更多
别忘想泡老子
3楼-- · 2019-03-26 15:47

http://msdn.microsoft.com/en-us/library/b0bktkzs.aspx says:

Examine the build log in the intermediate files directory to see what actually executed. The path and name of the build log is represented by the MSBuild macro expression, $(IntDir)\$(MSBuildProjectName).log.

[And the easiest way to get there is to do Project|Show all files, then go to Solution Explorer and right click to Open Folder in Windows Explorer]

EDIT: To appease our disgruntled -1er... You could obviously infer from this that you could add a <Execute Command="notepad.exe $(IntDir)\$(MSBuildProjectName).log"/> or similar if it needs to literally pop up, but that doesnt make sense to me.

EDIT 2: EXAMPLE. Edit the .csproj file, and in the section with

<!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   Other similar extension points exist, see Microsoft.Common.targets.

-->

Change it to:

<Target Name="AfterBuild">
    <Exec Command="notepad.exe $(IntDir)\$(MSBuildProjectName).log" />
</Target>

Reason I didnt expand it out is that this would get annoying quick. You could potentially put:

notepad.exe $(IntDir)\$(MSBuildProjectName).log

In your Post Build step. This would work slightly better as it would only fire when the compile has actually done something.

BTW highly recommend getting the Hashimi book - it makes all this stuff obvious and makes you give answers that assume its straightforward :P

查看更多
登录 后发表回答