views:

42

answers:

2

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  A: 

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

Ruben Bartelink
@Genius -1er: Can you please justify your downvote? This completely answers the question, citing a reference, with the relevant excerpt quoted. Or am I missing something?
Ruben Bartelink
Could you tell where or how $(IntDir) and $(MSBuildProjectName) are defined? I have no *.log files in my solution (I obviously checked that before asking). Also: where do you specify the <Execute entry?
Gerard
Most properties are [predefined in MSBuild](http://msdn.microsoft.com/en-us/library/bb629394.aspx). Think IntDir is new in 4.0. It means the intermediate directory, which is typically `obj` (not `bin`). That help? BTW if you're the -1er, I suggest fixing the attitude - People here are trying to help, and donwvoting without giving a reason doesnt make people want to answer.
Ruben Bartelink
@Gerard: BTW I didnt think for one second you hadnt done homework. I personally hadnt connected the dots as to where the file goes until I answered this question. I +1d the question in ack of this (homework done, interesting question). (And the reason I assume you're a -1er is that you havent upvoted)
Ruben Bartelink
I did not vote you down, on the contrary I appreciate the help. Indeed Hashimi knows it all (only possible for C++ projects). An upvote for your efforts, thanks.
Gerard
@Gerard, thanks, and sorry for any paranoia. -1s without explanations are still a pet peeve though. I should have remembered about `IntDir` - there are a stack of macros that have been in VS since the year dot, which overlap but are generally more abbreviated than the MSBuild naming style - this should have hinted that it was C++ only (you'd think the article I linked or the help summary for that Options page would cover it though - tech writers!).
Ruben Bartelink
+1  A: 

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

Sayed Ibrahim Hashimi