Using DevEnv In MSBuild
So new week, new post, and getting back to what I really started this blog. I like sharing knowledge, but part of the reason I blog about new versions of software is so that it motivates me to read up on what’s coming up, but the post today is typical of what I enjoy writing about the most. This post is about how to get projects that are unsupported by MSBuild built in an automated build.
Some projects cannot be compiled using MSBuild. Here is a list of project types that we can file under this category:
In a PropertyGroup, create key value pairs for the following:
Make the working directory the MSBuildProjectDirectory reserved property, just to avoid arbitrary errors. Here is an example below.
<Target Name="DevEnvInstaller"> <PropertyGroup> <DevEnv>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com</DevEnv> <SolutionFile>$(SolutionRoot)\Database\Ispac\SSISPackages.sln</SolutionFile> <ProjectFile>$(SolutionRoot)\Database\ISPac\SSISPackages\ETLBulkLoader.dtproj</ProjectFile> <Configuration>Release</Configuration> </PropertyGroup> <Exec> Command="&quot;$(devenv)&quot; &quot;$(SolutionFile)&quot; /Rebuild &quot;$(Configuration)&quot; /Project &quot;$(ProjectFile)&quot; /ProjectConfig &quot;$(Configuration)&quot; /Log" ContinueOnError="false" IgnoreExitCode="false" WorkingDirectory="$(MSBuildProjectDirectory)" /> </Target>
Ideally, you want to call this target from a reserved task, like AfterGet, so that you control when the target is executed.
<Target Name="AfterGet"> <CallTarget Targets="DevEnvInstaller"> </Target>
This now means that you can compile projects in an automated build.