msbuildbiztalkbiztalk-2009biztalk-deployment

MSBuild and BizTalk


Is it possible to specify (or override) the Deploy ApplicationName, database server, and database name for BizTalk projects? If so, how?

Unfortunately this data is stored in the btproj.user file instead of the .btproj file, and my client doesn't want to check the btproj.user files into the source control system.

(FYI - we are using BizTalk Build Generator from CodePlex.)


Solution

  • I've just reviewed the source on CodePlex. When I understood everything correctly they are generating

    %AppName%.Custom.targets
    %AppName%.Custom.properties
    

    files. Within the properties file some properties are listed for BTS Database Connectivity

    <BizTalkDatabaseServerName>.</BizTalkDatabaseServerName>
    <BizTalkManagementDatabaseName>BizTalkMgmtDB</BizTalkManagementDatabaseName>
    <BizTalkManagementDatabaseConnectionString>
     server=$(BizTalkDatabaseServerName);
     database=$(BizTalkManagementDatabaseName);
     integrated security=sspi;
    </BizTalkManagementDatabaseConnectionString>
    <PipelineComponentsFolderPath>C:\Program Files\Microsoft BizTalk Server 2010\Pipeline Components</PipelineComponentsFolderPath>
    

    You could easily override these Property values by using the commandline or by adding additional msbuild arguments in VS or TeamBuild using the Property switch

    msbuild.exe MyBizTalkProject.proj /p:BizTalkDatabaseServerName=SqlCluster 
    

    The developer of this project should rewrite the default MSBuild.Custom.properties file to look like this

    <BizTalkDatabaseServerName Condition="'$(BizTalkDatabaseServerName)'==''">.</BizTalkDatabaseServerName>
    

    By using this approach the "." identifier (for local SQL Server) will only be used when no value for the parameter is given. Because with the current implementation the definition of the Property could! override you value passed from the command line. So be aware of that.