Tuesday, August 11, 2009

Using devenv.exe in MSBuild Files and TFS

I need to run devenv.exe on our team build (TFS) in order to compile certain projects (for example: setups).

If, like in our case, the tfsbuld.proj file is not only used on the TFS but also for local builds you have to find out here devenv.exe actually is (it depends on your Windows version an language).

The trick is that MSBuild can read registry information. So you can get the install directory for Visual Studio from the registry and then use an Exec task to run devenv.exe.

Here is how this works:

<Exec Command="&quot;$(Registry:HKEY_LOCAL_MACHINE\\Software\Microsoft\VisualStudio\9.0@InstallDir)\Common7\IDE\devenv&quot; &quot;$(SolutionRoot)\mysolution.sln&quot; /Build Release /project &quot;setupdir\setupproj.vdproj" /projectconfig Release"/>
Post a Comment