Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2010: minimal build log in output and detailed log in log file

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.

like image 255
Gerard Avatar asked Aug 06 '10 09:08

Gerard


People also ask

How do I get the build log in Visual Studio?

To create a build log file for a managed-code projectOn the menu bar, choose Build > Build Solution. In the Output window, click somewhere in the text. Press Ctrl+S. Visual Studio prompts you for a location to save the build output.

How do I display the output window in Visual Studio?

To display the Output window whenever you build a project, in the Options dialog box, on the Projects and Solutions > General page, select Show Output window when build starts.

Where are Visual Studio logs saved?

Start Visual Studio ( devenv.exe ) with /Log parameter. You can press Start+R and then enter the command below for Visual Studio 2019 Enterprise. Change the path to devenv.exe depending on the actual Visual Studio version. The log file will be found in %AppData%\Microsoft\VisualStudio\ , under a subdirectory (*).


2 Answers

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

like image 196
Sayed Ibrahim Hashimi Avatar answered Sep 21 '22 06:09

Sayed Ibrahim Hashimi


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

like image 30
Ruben Bartelink Avatar answered Sep 19 '22 06:09

Ruben Bartelink