Archive for the ‘MS Build’ Category

Log the Output from your MSBuild Tasks

Thursday, June 26th, 2008

In an automated build process, you always need logs as reference for troubleshooting because the task is scheduled and running under the context of a different user, so you won’t be able to see console output.

If you use MSBuild to run your build tasks, here is how to get it to write to a text file when it runs:

msbuild mybuildroutines.msbuild /p:Desitination=WebServer /t:DeployAndTestWebServerBuild /l:FileLogger,Microsoft.Build.Engine;logfile=c:\temp\DeployAndTestWebServerBuild.log

Thanks to Miles for discovering this incredibly useful feature.

Intellisense for MSBuild files

Thursday, September 27th, 2007

To “enable” Intellisense for MSBuild projects ending with the extension “msbuild”:

1)      1) Add this registry key (no line break in the key):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\
{412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions]“msbuild”=dword:00000029

2)      Create a file called “test.msbuild” and then try to open it.  Choose “Select program from list” and browse to VS2005 devenv.exe and check “Always use the selected”.  Click ok.  Once Visual Studio opens, you should have it!  (Since the XSD for MSBuild is already “known” by Visual studio.  Fyi – the file is located here:

\windows\Microsoft.NET\framework\v2.0.50727\Microsoft.Build.xsd

and

\Program Files\Microsoft Visual Studio 8\xml\Schemas\1033

there.

If you don’t like using the .msbuild extension, you can change it.  Just modify the registry key, changing “msbuild” to whatever extension you would like to use.