ProjectName+EnvironmentName

Topics: Bindings File, Settings Management and SSO, Server Deployment, Tips and Tricks
May 19, 2014 at 2:27 PM
Hi,

I have a requirement where I have to deploy BTDF generated MSI on number of envrionments such as SYSTEST1, TRAINING1,Developement1 etc.

Each time I have to build MSI for difference environments to have a naming convention such as
<ProjectName>sdm.pubsub3.sys1</ProjectName>
<ProjectName>sdm.pubsub3.dev1</ProjectName>
<ProjectName>sdm.pubsub3.train1</ProjectName>

in My Deployment.btdfproj file.

Is there a way where I can supply this as parameter at run time where it can generate <ApplicationName>sdm.pubsub3.sys1</ApplicationName> etc on the fly by taking parameter from SettingsFileGenerator.xml file for my PortBinding.xml

Thanks for you help

Neeraj
Coordinator
Jun 2, 2014 at 5:12 AM
Add a setting in the settings spreadsheet with the BizTalk app names in the appropriate columns, and add the setting name (for example, AppName, used below) to the PropsFromEnvSettings item in the .btdfproj.

Then add a target like this:
<Target Name="PreInitializeAppName" BeforeTargets="InitializeAppName">
  <PropertyGroup>
    <BizTalkAppName>$(AppName)</BizTalkAppName>
  </PropertyGroup>
</Target>
I'm assuming that you're on BizTalk 2010 or newer. Hopefully that will get you the configured BizTalk application name for each environment.

Thanks,
Tom
Jun 3, 2014 at 5:11 PM
Thanks Tom,

I did the following.

in Deployment.btdfproj added

<ItemGroup>
<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;ApplicationName" />
</ItemGroup>

in BizTalkDeploymentFramework.targets added

<Target Name="PreInitializeAppName" BeforeTargets="InitializeAppName">
<PropertyGroup>
<BizTalkAppName>$(ApplicationName)</BizTalkAppName>
</PropertyGroup>
</Target>

BEFORE

<Target Name="InitializeAppName" Condition="'$(BizTalkAppName)' == ''">
<CreateProperty Value="$(ProjectName)_$(ProjectVersion)" Condition="'$(EnableSideBySide)' == 'true'">
  <Output TaskParameter="Value" PropertyName="BizTalkAppName" />
</CreateProperty>
<CreateProperty Value="$(ProjectName)" Condition="'$(EnableSideBySide)' != 'true'">
  <Output TaskParameter="Value" PropertyName="BizTalkAppName" />
</CreateProperty>
<Message Text="BizTalk Application Name is $(BizTalkAppName)" />
</Target>


Lastly
in SettingFileGenerator for 'Exported_LocalSettings.xml' I added the following ROW
Setting: Test
ApplicationName sdm.pubsub3.sys1


Did the build MSI.


Issue during deployment:

EXEC : error : Unable to generate Luid. Provide the following parameter(s). [C:
\Program Files (x86)\pubsub3 for BizTalk\1.0\Deployment\Deployment.btdfproj]
-Source    Required. The 'SourceLocation' property of the resource.

That happens When the following part of the code is executed

<Target Name="DeploySchemas" DependsOnTargets="UndeploySchemas" Condition="'$(IncludeSchemas)' == 'true'">
<!-- Deploy schema assemblies. -->
<Exec Command
        ="BTSTask.exe AddResource -Type:BizTalkAssembly -Source:&quot;@(SchemasQualified)&quot; -ApplicationName:&quot;$(BizTalkAppName)&quot; -Options:GacOnAdd,GacOnImport,GacOnInstall -Overwrite"
        Condition="'$(DeployBizTalkMgmtDB)' == 'true' and '%(Identity)' == '%(Identity)'" />

  <Exec Command="&quot;$(Gacutil)&quot; /f /i &quot;@(SchemasQualified)&quot;"
      Condition="'$(DeployBizTalkMgmtDB)' == 'false' and '%(Identity)' == '%(Identity)'" />
</Target>

My Question:

Is it because of the new variable ApplicationName (because I was able to deploy the application previously)..
Thanks
Neeraj
Coordinator
Jun 4, 2014 at 6:31 AM
Hi Neeraj,

Please undo your changes to BizTalkDeploymentFramework.targets. Place the Target into your .btdfproj instead. Also, do your testing first using Visual Studio to deploy rather than the MSI. It will save you a lot of time.

The error that you listed seems to indicate that the Schemas ItemGroup is not populated at all. Maybe you've affected something else by editing the .targets file.

You can temporarily make your Visual Studio deployment use a different settings XML than the Local Development environment by adding the property DeveloperPreProcessSettings to a PropertyGroup in your .btdfproj. The default value is $(MSBuildProjectDirectory)\EnvironmentSettings\Exported_LocalSettings.xml.

Thanks,
Tom
Marked as answer by neerajk on 6/5/2014 at 7:23 AM
Jun 10, 2014 at 4:29 PM

Hi Tom,

Thanks for all the help. I have described in details what I am trying to achieve below.

Present Deployment:

Which is mixture of Custom Deployment Manager out put such as version number which gets application name as sdm.pubsub3.UAT1 and stamped version for assemblies for example: Version=14.6.400.58857 using custom code, in the MSBUILD, NANT, and PowerShell

current

Hosthostinstance

Issue:

Deployment using ‘BTDF’ I am not able to pass the version such as Version=14.6.400.58857 and application name as sdm.pubsub3.UAT1 Dynamically using Setting file generator. After several attempts I still get the results as shown below. Where the Assemble version is 1.0.0.0 and the application name is SDM.pubsub3.

present

I am using the TAG <ApplicationName>${AppName}</ApplicationName>

In ‘PortBindingMaster.XML’ which generates <ApplicationName>sdm.pubsub3</ApplicationName> I am expecting it to be ‘sdm.pubsub3.uat1

In ‘PortBinding.xml’ after using AppName=sdm.pubsub3.uat1 as one of the input to the deployment.

Current Deployment.btdproj ‘Tag ’

I have pasted the whole document but changes I have made further to your suggestion is

<ItemGroup>

<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;AppName" />

</ItemGroup>

<Target Name="PreInitializeAppName" BeforeTargets="InitializeAppName">

<PropertyGroup>

<BizTalkAppName>$(AppName)</BizTalkAppName>

</PropertyGroup>

</Target>

I have also added ‘Name="PreInitializeAppName"’ in ‘BizTalkDeploymentFramework.targets’ file, not sure if it correct or not. But they are in the same sections as that of ‘Name="InitializeAppName"

<?xml version="1.0" encoding="utf-8"?>

<!--

Deployment Framework for BizTalk

Copyright (C) 2008-14 Thomas F. Abraham, 2004-08 Scott Colestock

-->

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

<PropertyGroup>

<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>

<Platform Condition="'$(Platform)' == ''">x86</Platform>

<SchemaVersion>1.0</SchemaVersion>

<ProjectName>sdm.pubsub3</ProjectName>

<ProjectVersion>1.0</ProjectVersion>

<IncludeComponents>True</IncludeComponents>

<IncludeTransforms>True</IncludeTransforms>

<IncludePipeline>True</IncludePipeline>

<IncludePublicWs>True</IncludePublicWs>

<IncludeHelper>True</IncludeHelper>

<IncludeSchemas>True</IncludeSchemas>

<IncludeBizTalkAppName>True</IncludeBizTalkAppName>

<IncludeExternalAssemblies>True</IncludeExternalAssemblies>

<IncludeOrchestrations>True</IncludeOrchestrations>

<IncludeMaps>True</IncludeMaps>

<IncludePipelineComponents>True</IncludePipelineComponents>

<IncludeVirtualDirectories>True</IncludeVirtualDirectories>

<IncludeDeploymentTest>True</IncludeDeploymentTest>

<IncludeSSO>True</IncludeSSO>

<IncludeMessagingBindings>True</IncludeMessagingBindings>

<UsingMasterBindings>True</UsingMasterBindings>

<UseCustomDirs>True</UseCustomDirs>

<RequireXmlPreprocessDirectives>False</RequireXmlPreprocessDirectives>

<ApplyXmlEscape>True</ApplyXmlEscape>

</PropertyGroup>

<PropertyGroup>

<!-- Properties related to building an MSI for server deployments -->

<!-- BizTalk App Version Upgrade -->

<!-- For each new product release to be deployed to your BizTalk servers: -->

<!-- 1) Increment ProductVersion -->

<!-- 2) Generate a new GUID and update ProductId with the new GUID -->

<!-- This allows the new MSI to automatically uninstall (not undeploy!) the old MSI and install the new one. -->

<ProductVersion>1.0.0</ProductVersion>

<ProductId>b69b1266-24fd-465d-9d6b-84e335fd2fea</ProductId>

<!-- BizTalk App Version Upgrade -->

<ProductName>pubsub3 for BizTalk</ProductName>

<Manufacturer>Deployment Framework User</Manufacturer>

<PackageDescription>pubsub3</PackageDescription>

<PackageComments>pubsub3</PackageComments>

<!-- NEVER change the ProductUpgradeCode. -->

<ProductUpgradeCode>1d7c0766-928e-4ead-9781-84707270d878</ProductUpgradeCode>

</PropertyGroup>

<!-- Under TFS Team Build, set CustomizableOutDir property to true in TFS 2005/2008/2010 UpgradeTemplate. -->

<!-- With a workflow build, copy the default template then modify the MSBuild task for the solution build. Set OutDir to blank and -->

<!-- CommandLineArguments to String.Format("/p:SkipInvalidConfigurations=true;TeamBuildOutDir=""{0}"" {1}", BinariesDirectory, MSBuildArguments). -->

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">

<DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>

<OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Debug\</OutputPath>

<OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>

<DeployPDBsToGac>false</DeployPDBsToGac>

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">

<DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>

<OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Release\</OutputPath>

<OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>

<DeployPDBsToGac>false</DeployPDBsToGac>

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Server'">

<DeploymentFrameworkTargetsPath>Framework\</DeploymentFrameworkTargetsPath>

<!-- Get our PDBs into the GAC so we get file/line number information in stack traces. -->

<DeployPDBsToGac>true</DeployPDBsToGac>

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Server'">

<!-- Get our PDBs into the GAC so we get file/line number information in stack traces. -->

<DeployPDBsToGac>true</DeployPDBsToGac>

</PropertyGroup>

<ItemGroup>

<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;AppName" />

</ItemGroup>

<!-- !!! TODO !!! -->

<!-- Add ItemGroup elements that contain one or more Schemas, Orchestrations, Transforms, etc. elements that describe -->

<!-- the specific artifacts in your solution that need to be deployed. Use IntelliSense as a guide. -->

<ItemGroup>

<AdditionalFiles Include="sdm.pubsub3.maps.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\pubsub3\maps\bin\release</LocationPath>

</AdditionalFiles>

</ItemGroup>

<ItemGroup>

<AdditionalFiles Include="sdm.pubsub3.orchestrations.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\pubsub3\orchestrations\bin\release</LocationPath>

</AdditionalFiles>

</ItemGroup>

<ItemGroup>

<AdditionalFiles Include="sdm.pubsub3.pipelines.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\pubsub3\pipelines\bin\release</LocationPath>

</AdditionalFiles>

</ItemGroup>

<ItemGroup>

<AdditionalFiles Include="sdm.pubsub3.schemas.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\pubsub3\schemas\bin\release</LocationPath>

</AdditionalFiles>

</ItemGroup>

<ItemGroup>

<ExternalAssemblies Include="sdm.pubsub3.helper.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\pubsub3\orchestrations\bin\release</LocationPath>

</ExternalAssemblies>

</ItemGroup>

<ItemGroup>

<ExternalAssemblies Include="sdm.pubsub3.publicws.dll">

<LocationPath>E:\SDM_DEV\Trunk\Code\DELIVERY\lib\pubsub3</LocationPath>

</ExternalAssemblies>

</ItemGroup>

<!-- IIS-->

<ItemGroup>

<VDirList Include="*">

<Vdir>sdm.pubsub3.test</Vdir>

<Physdir>..\sdm.pubsub3.test</Physdir>

<AppPool>BizTalkAppPool</AppPool>

</VDirList>

</ItemGroup>

<!-- Set AppPool .NET version -->

<Target Name="pubsub3">

<Exec Command=""C:\Windows\System32\inetsrv\appcmd.exe" set APPPOOL /apppool.name:"BizTalkBasicHttp" /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated" />

</Target>

<Target Name="PreInitializeAppName" BeforeTargets="InitializeAppName">

<PropertyGroup>

<BizTalkAppName>$(AppName)</BizTalkAppName>

</PropertyGroup>

</Target>

<!-- !!! TODO !!! -->

<Import Project="$(DeploymentFrameworkTargetsPath)BizTalkDeploymentFramework.targets" />

<!--

The Deployment Framework automatically packages most files into the server install MSI.

However, if there are special folders that you need to include in the MSI, you can

copy them to the folder $(RedistDir) in the CustomRedist target.

To include individual files, add an ItemGroup with AdditionalFiles elements.

-->

<Target Name="CustomRedist">

</Target>

</Project>

Jun 23, 2014 at 5:27 PM
Hi.
I got it working by using ProjectName instead of BizTalkAppName
<Target Name="PreInitializeAppName" BeforeTargets="InitializeAppName">
  <PropertyGroup>
    <ProjectName>$(AppName)</ProjectName>
  </PropertyGroup>
</Target>
/Bo.