PDA

View Full Version : How do I redirect MSBuild's output to file?


tikskit
02-24-2012, 01:11 AM
I need to log the output of MSBuild action to a plain text file. If a compilation fail, I will send the file by email.
If I did it in command line, I would write something like:
MSBuild project.sln >> my.log

But how do I do it using MSBuild action?
Thank you in advance!

P.S. I use 7.7 version

kinook
02-24-2012, 08:34 AM
http://msdn.microsoft.com/en-us/library/ms171470%28v=vs.100%29.aspx

Shiamak
03-07-2012, 02:24 PM
Hi,

I have my own build.xml file which works fine at the visual studio command prompt and compiles all the projects, however I would like to incorporate this in VisualBuild using MSBuild action, is it possible , if you do hve an example this will be really helpful.

Best

kinook
03-07-2012, 04:20 PM
In the MSBuild action, specify the build.xml file in the Project file field on the Project tab, and the vcvarsall.bat file (as called by the VS Command Prompt) in the Command to run before main command field on the Advanced tab.
http://www.kinook.com/VisBuildPro/Manual/msbuildprojtab.htm
http://www.kinook.com/VisBuildPro/Manual/programadvancedtab.htm

Shiamak
03-07-2012, 05:05 PM
THanks, the build.xml i am using complies all the projects fine when used after initiating "Visual Studio 2008 Command prompt" manually but when I use the same build.xml with the MSBUILD in visualbuild (as mentioned by you earlier, I get the message that "OUTPUTDIR is not specified for one of the projects"

??

kinook
03-07-2012, 05:17 PM
Take it in steps to ensure everything is setup the same in Visual Build.

1) Run Visual Build from the VS 2008 Command Prompt (start VisBuildPro<enter>), add a Run Program step that makes the same msbuild call as done manually (also set the Start in field to the working folder of the Command Prompt), and build.

2) Add a Set Current Dir step to set the build dir to the working folder of the command prompt, and following that, add a MSBuild step to call the build.xml (select any option or add flags as needed to match the manual msbuild call), and rebuild.

3) Add the vcvarsall.bat call to the MSBuild step as mentioned previously to avoid needing to start Visual Build from the VS 2008 Command Prompt, start Visual Build from a shortcut and build the project.

Shiamak
03-07-2012, 05:55 PM
I am sorry I am a bit confused, you want me to run step 1 with setting MSBUILD call to my Build.xml? or to set environment vs 2008? bat file?

Also Am i adding "set current dir" right after step 2? what does working folder imply here?

where am I adding call to vcvarsall.bat?

I am sorry for the confusion..
Take it in steps to ensure everything is setup the same in Visual Build.

1) Run Visual Build from the VS 2008 Command Prompt (start VisBuildPro<enter>), add a Run Program step that makes the same msbuild call as done manually (also set the Start in field to the working folder of the Command Prompt), and build.

2) Add a Set Current Dir step to set the build dir to the working folder of the command prompt, and following that, add a MSBuild step to call the build.xml (select any option or add flags as needed to match the manual msbuild call), and rebuild.

3) Add the vcvarsall.bat call to the MSBuild step as mentioned previously to avoid needing to start Visual Build from the VS 2008 Command Prompt, start Visual Build from a shortcut and build the project.

kinook
03-07-2012, 06:07 PM
The first step would be to reproduce your msbuild call within Visual Build via a Run Program action (starting Visual Build from the VS 2008 command prompt to replicate the environment it initializes).

The second step would be to convert this to a MSBuild step in Visual Build, preceded by a Set Current Dir step to set the working folder (still starting from the VS 2008 command prompt).

The third step would be to call the vcvarsall.bat (what the Visual Studio 2008 Command Prompt does) in the MSBuild step's Command to run before main command field on the Advanced tab, to setup the environment within the build instead of relying on the VS command prompt.

Shiamak
03-07-2012, 06:22 PM
The first step would be to reproduce your msbuild call within Visual Build via a Run Program action (starting Visual Build from the VS 2008 command prompt to replicate the environment it initializes).

The second step would be to convert this to a MSBuild step in Visual Build, preceded by a Set Current Dir step to set the working folder (still starting from the VS 2008 command prompt).

The third step would be to call the vcvarsall.bat (what the Visual Studio 2008 Command Prompt does) in the MSBuild step's Command to run before main command field on the Advanced tab, to setup the environment within the build instead of relying on the VS command prompt.

Thanks a bunch, I have gotten further, but now it seems like the VisualBuild (or compiler) is complaining about some Tracker.exe , for increamental build.. where can this exe be obtained?

kinook
03-07-2012, 06:34 PM
Visual Build itself doesn't call or use any Tracker.exe. Maybe its path is not in the PATH environment of the Visual Build process and it can't be located?

Shiamak
03-07-2012, 06:38 PM
Visual Build itself doesn't call or use any Tracker.exe. Maybe its path is not in the PATH environment of the Visual Build process and it can't be located?

I dont have tracker.exe on my machine anywhere, however this blog http://bradwilson.typepad.com/blog/2010/05/working-around-build-error-msb3454.html
describe the need for it but I dont wanna update my build machine to vs 2010.

Please help.

kinook
03-07-2012, 06:44 PM
Looks like you would need to disable tracking as mentioned in that article, or maybe install the Windows SDK.

Shiamak
03-09-2012, 01:47 PM
Hi,

I totally appreciate your prompt and useful inputs, however the problem was not with Tracker.exe (infact there is NO TRACKER.EXE that is being shipped with VS 2008) but it turned out that VisualBuld by default was using MSBUILD.EXE in .net framework v4.0 which LOOKS FOR TRACKER.EXE for incremental compilation.

The simplest solution that I figured out was to OVERRIDE MSBUILD.EXE with .net framework v3.5 and wallah...it all worked great..

I just wanted to share the closure on this issue so if someone else is facing the same issue, this solution could help em.

Thanks again for the wonderful work and keep up the good work!

VisualBUild is much appreciated in my part of the world.