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:
- Location on devenv on server (even if you do not have Visual Studio installed you can copy/paste into a directory… I think. You may need to add a few extra items.)
- The location of the solution that has the unsupported project
- The location of the unsupported project
- The configuration you want to build (debug/release/custom…)
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.