Automating Compilation of Visual Studio 2005 BizTalk projects

Hi Folks,

When I prepare to deploy my BizTalk assemblies and related projects, I usually choose MSBuild for the task. However, MSBuild and BizTalk projects are not compatible, and warnings will be issued if you do try to build them.

In such cases, what I do is use a different compilation tool and just include it in my main MSBuild script. I have written about MSBuild in my other blogs on this site, if you interested to take a look at how it works in more detail.

 

Below is sample on how I incorporate my BizTalk projects into my build scripts:

@echo off
"C:\Program Files\Microsoft Visual Studio 8\Common7\Ide\devenv" MMIT.FileManagement.sln /build "Release" /project MMIT.FileManagement.Orchestrations\MMIT.FileManagement.Orchestrations.btproj /projectconfig "Deployment"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild MMIT.FileManagement.build
pause

As you can see I use the devenv command to build my BizTalk bases solutions. Then I call MSBuild to prepare my deployment scripts, below is the sample build script referenced here as MMIT.FileManagement.build

 

<Project  xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >

    <!– Set the application name as a property –>
    <PropertyGroup>
        <OutputPath>Build</OutputPath>
        <SourceDir1>MMIT.FileManagement.WebServices</SourceDir1>
        <SourceDir2>MMIT.FileManagement.BOL</SourceDir2>
        <SourceDir3>MMIT.FileManagement.BOL.Rules</SourceDir3>
        <SourceDir4>MMIT.FileManagement.DAL</SourceDir4>
        <SourceDir5>MMIT.FileManagement.Logging</SourceDir5>
        <SourceDir6>MMIT.FileManagement.Orchestrations</SourceDir6>
        <BuildDirWeb>Build\$(SourceDir1)</BuildDirWeb>
        <BuildDirGACWS>Build\BaseAssembliesToGAC\WS_Servers</BuildDirGACWS>
        <BuildDirGACBizTalk>Build\BaseAssembliesToGAC\BizTalk_Servers</BuildDirGACBizTalk>
        <Configuration>Release</Configuration>
    </PropertyGroup>

    <Target Name="MakeBuildDirectory">
        <MSBuild Projects="MMIT.FileManagement.sln" Targets="Rebuild" ></MSBuild>
        <CreateItem Include="$(SourceDir1)\bin\*.dll">
            <Output TaskParameter="Include" ItemName="WebBinFiles"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir2)\bin\Release\*.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesWS"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir3)\bin\Release\*.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesWS"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir4)\bin\Release\*.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesWS"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir5)\bin\Release\*.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesWS"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir6)\bin\Deployment\MMIT.*.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesBizTalk"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir6)\bin\Deployment\MMIT.Common.dll">
            <Output TaskParameter="Include" ItemName="GACBinFilesCommon"/>
        </CreateItem>
        <CreateItem Include="$(SourceDir1)\*.asmx;$(SourceDir1)\*.config;$(SourceDir1)\*.asax">
            <Output TaskParameter="Include" ItemName="WebServiceFiles"/>
        </CreateItem>
        <Copy SourceFiles="@(WebServiceFiles)" DestinationFolder="$(BuildDirWeb)"/>
        <Copy SourceFiles="@(WebBinFiles)" DestinationFolder="$(BuildDirWeb)\bin"/>
        <Copy SourceFiles="@(GACBinFilesWS)" DestinationFolder="$(BuildDirGACWS)"/>
        <Copy SourceFiles="@(GACBinFilesBizTalk)" DestinationFolder="$(BuildDirGACBizTalk)"/>
        <Copy SourceFiles="@(GACBinFilesCommon)" DestinationFolder="$(BuildDirGACWS)"/>
    </Target>
</Project>

The script above will prepare deployment folders based on server types for me, due to distributed components, and my output is as follows:

Below MSBULD, groups my assemblies into those for the GAC, and also those for web services only.

image

image

Also, those that need to be put in the GAC, are again grouped by server roles, in the event your production environment has dedicated hardware for web services, BizTalk servers, and web sites.

image

Advertisements
Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s