Environment Settings and Different Build Relation

Topics: Bindings File, Settings Management and SSO
Apr 19, 2013 at 7:01 PM
Hi
I have started using BTDF recently and I have this question about environment setting generated file. When we build/deploy how it knows which setting xml file to pickup for preprocessing binding file for specific environment DEV, QA, etc. I saw some threads and still did not get the clear picture.

I am also having problem in deploying an application where the generated setting file is not picked up to pass as argument to XmlPreProcess tool, /s parameter remain null. I am able to deploy successfully from Visual studio however after I create MSI and install on my own machine then it fails. I have even tried using <DeveloperPreProcessSettings>. I am also using DeploymentFrameworkForBizTalkV5_0_25RC version.
 "C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\Framework\DeployTools\EnvironmentSettingsExporter.exe" "C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\EnvironmentSettings\SettingsFileGenerator.xml" "C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\EnvironmentSettings"
            Environment Settings Spreadsheet to XML Exporter 1.6.0
            [http://EnvSettingsManager.codeplex.com]
            Copyright (C) 2007-10 Thomas F. Abraham.  All Rights Reserved.
            
            Importing from SettingsFileGenerator.xml...
            
            Output format is XmlPreprocess (multi-file).
            
            Exporting to Debug_settings.xml...
            Exporting to Release_settings.xml...
            Exporting to QA_settings.xml...
            Exporting to PROD_settings.xml...
            
            Finished.
        Target InitializeAppName:
            BizTalk Application Name is HL7.Meditech.NMI.VXU.V251
        Target InitSettingsFilePath:
            Invalid settings file path (OK on server undeploy).
        Target PreprocessBindings:
            Clearing file attributes for 'PortBindingsMaster.xml'.
            "C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\Framework\DeployTools\xmlpreprocess.exe" /f /v /c /noDirectives /i:"C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\PortBindingsMaster.xml" /o:"C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0\Deployment\PortBindingsMaster.xml" /d:CurDir="C:\Program Files (x86)\HL7.Meditech.NMI.VXU.V251\1.0" /s:""
            XmlPreprocess v2.0.13.0
            Copyright (c) 2004-2010 Loren M Halvorson
            XML File Preprocessor
            
            /s:: Argument expects a parameter
Apr 22, 2013 at 1:47 PM
This issue is fixed now, I needed to add a config item in InstallWizard.xml as follows:
<SetEnvUIConfigItem>
<PromptText>Select the XML file that contains configuration information specific to this environment:</PromptText>
<PromptValue></PromptValue>
<ValueType>FileSelect</ValueType>
<EnvironmentVarName>ENV_SETTINGS</EnvironmentVarName>
</SetEnvUIConfigItem>
<SetEnvUIConfigItem>
Coordinator
Apr 29, 2013 at 5:23 AM
Just an FYI -- the path is saved into an environment variable named ENV_SETTINGS, and conveniently MSBuild sees all environment variables as properties, so it's equivalent to an MSBuild property named $(ENV_SETTINGS). If you were automating it you would pass the path as an MSBuild property on the command line.

I strongly encourage you to upgrade to v5.0 RTW. There's no reason to still run a Release Candidate version.

Thanks,
Tom
May 10, 2013 at 9:57 PM
Edited May 10, 2013 at 10:00 PM
Hi Tom,

I was trying to deploy the BTDF app using command prompt. As suggested in the document I followed the step of installing msi, then generating settings xml and then passing it as parameters ENV_SETTINGS to msbuild however I keep getting the same /s:: Argument expects a parameter error. I also set the ENV_SETTINGS environment variable and still got the issue.

msiexec.exe /i MyBizTalkApp.msi /passive /log MyBizTalkAppInstall.log INSTALLDIR="C:\Program Files\MyBizTalkApp\1.0"

"C:\Program Files\MyBizTalkApp\1.0\Deployment\Framework\DeployTools\EnvironmentSettingsExporter.exe" "C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings\SettingsFileGenerator.xml" "C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings"

"%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" /p:DeployBizTalkMgmtDB=true;Configuration=Server;SkipUndeploy=true /target:Deploy /l:FileLogger,Microsoft.Build.Engine;logfile="C:\Program Files\MyBizTalkApp\1.0\DeployResults\DeployResults.txt" "C:\Program Files\MyBizTalkApp\1.0\Deployment\MyBizTalkApp.btdfproj"

I completed all above steps and still failing with issue.
I have 5.0 RTW release of BTDF. My machine environment is Win7 64 bit, Visual Studio 2010, BizTalk Server 2010

Can you suggest something what could be the problem. I have set the settings path correctly in session environment variable as well.

One thing I noticed, is even though I am setting up ENV_SETTINGS env variable, BTDF proj is still generating settings file again, which does not seem right
Coordinator
May 10, 2013 at 11:25 PM
Edited May 10, 2013 at 11:25 PM
Hi,

The step of calling EnvironmentSettingsExporter.exe is not necessary (documentation error). You need to know the correct and complete path to the XML file, but do not need to actually export it because that will happen once the deployment begins.

Note the ENV_SETTINGS parameter in the example below -- your current process should do the same.

I'd actually encourage you to upgrade to v5.1 since you are just beginning to script this process. Using v5.1 you can use the following new MSBuild targets file (you still need your msiexec step too):

For this example,
  • Assuming BizTalk 2010 (/tv:4.0)
  • Assuming that default MSBuild.exe on the system is MSBuild 4.0
  • Assuming that current dir is C:\Program Files\MyBizTalkApp\1.0
MSBuild.exe Deployment\Framework\BizTalkDeploymentFramework.ServerExecute.targets /tv:4.0 /t:Deploy /p:BT_DEPLOY_MGMT_DB=True /p:ENV_SETTINGS="C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings\Exported_LocalSettings.xml" /p:ProjectFile=Deployment.btdfproj
Thanks,
Tom
May 13, 2013 at 2:33 PM
My big problem is that ENV_SETTINGS path is not set whether I set it as environment variable or pass it as parameter to msbuild.

Do I need to make any change to my btdfproj file in order to run it as script? Following is my btdfproj file and the logs after running it on command prompt
<?xml version="1.0" encoding="utf-8"?>
<!-- 
  Deployment Framework for BizTalk 5.0
  Copyright (C) 2004-2012 Thomas F. Abraham and 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>CDM.BizTalk.EnterpriseServices</ProjectName>
    <ProjectVersion>1.0</ProjectVersion>
    <IncludeOrchestrations>False</IncludeOrchestrations>
    <IncludePipelines>False</IncludePipelines>
    <IncludePipelineComponents>True</IncludePipelineComponents>
    <UsingMasterBindings>True</UsingMasterBindings>
    <RequireXmlPreprocessDirectives>False</RequireXmlPreprocessDirectives>
    <SkipIISReset>True</SkipIISReset>
    <SkipHostInstancesRestart>True</SkipHostInstancesRestart>
    <StartApplicationOnDeploy>False</StartApplicationOnDeploy>
    <EnableAllReceiveLocationsOnDeploy>False</EnableAllReceiveLocationsOnDeploy>
    <StartReferencedApplicationsOnDeploy>False</StartReferencedApplicationsOnDeploy>
    <IncludeSettingsSpreadsheetInMsi>True</IncludeSettingsSpreadsheetInMsi>
  </PropertyGroup>
  <PropertyGroup>
    <ProductVersion>1.0.0</ProductVersion>
    <ProductId>4cae43c5-20e2-4e7d-9a10-d094de398253</ProductId>
    <!-- BizTalk App Version Upgrade -->
    <ProductName>CDM.BizTalk.EnterpriseServices</ProductName>
    <Manufacturer></Manufacturer>
    <PackageDescription>CDM.BizTalk.EnterpriseServices</PackageDescription>
    <PackageComments>CDM.BizTalk.EnterpriseServices</PackageComments>
    <!-- NEVER change the ProductUpgradeCode. -->
    <ProductUpgradeCode>fd1cd217-0995-4eb7-8c90-2ffb56618164</ProductUpgradeCode>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>
    <DeploymentFrameworkInstallPath>C:\Program Files (x86)\Deployment Framework for BizTalk\5.0\</DeploymentFrameworkInstallPath>
    <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>
    <DeploymentFrameworkInstallPath>C:\Program Files (x86)\Deployment Framework for BizTalk\5.0\</DeploymentFrameworkInstallPath>
    <OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Release\</OutputPath>
    <OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>
    <DeployPDBsToGac>false</DeployPDBsToGac>
  </PropertyGroup>
 
  <PropertyGroup Condition="'$(Configuration)' == 'QA'">
    <DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>
    <DeploymentFrameworkInstallPath>C:\Program Files (x86)\Deployment Framework for BizTalk\5.0\</DeploymentFrameworkInstallPath>
    <OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Release\</OutputPath>
    <OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>
    <DeployPDBsToGac>false</DeployPDBsToGac>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'PROD'">
    <DeploymentFrameworkTargetsPath>Framework\</DeploymentFrameworkTargetsPath>
    <!-- Get our PDBs into the GAC so we get file/line number information in stack traces. -->
    <DeployPDBsToGac>true</DeployPDBsToGac>
  </PropertyGroup>
  <!-- !!! 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>
    <Schemas Include="CDM.BizTalk.AckMgmt.dll">
      <LocationPath>..\CDM.BizTalk.AckMgmt\bin\$(Configuration)</LocationPath>
    </Schemas>
    <Schemas Include="CDM.BizTalk.AuditMgmt.dll">
      <LocationPath>..\CDM.BizTalk.AuditMgmt\bin\$(Configuration)</LocationPath>
    </Schemas>
    <Schemas Include="CDM.BizTalk.ErrorMgmt.dll">
      <LocationPath>..\CDM.BizTalk.ErrorMgmt\bin\$(Configuration)</LocationPath>
    </Schemas>
    <Transforms Include="CDM.BizTalk.AuditMgmt.Maps.dll">
      <LocationPath>..\CDM.BizTalk.AuditMgmt.Maps\bin\$(Configuration)</LocationPath>
    </Transforms>
    <PipelineComponents Include="ErrorMgmt.CustomPipeline.dll">
      <LocationPath>..\..\ErrorMgmt.CustomPipeline\bin\$(Configuration)</LocationPath>
    </PipelineComponents>
  </ItemGroup>
  <!-- !!! 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">
    <Exec command="%22$(DeploymentFrameworkInstallPath)Framework\DeployTools\EnvironmentSettingsExporter.exe%22 EnvironmentSettings\SettingsFileGenerator.xml $(RedistDir)\Deployment\EnvSettings\" ></Exec>
  </Target>-->
</Project>
C:\WINDOWS\system32>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServices\1.0\Deployment\Deployment.btdfproj" /p:DeployBizTalkMgmtDB=True;Configuration=QA;SkipUndeploy=t
rue /target:Deploy /l:FileLogger,Microsoft.Build.Engine;logfile="C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServices\1.0\DeployResults\DeployResul
ts.txt" /p:ENV_SETTINGS="C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServices\1.0\Deployment\EnvironmentSettings\QA_Settings.xml"
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.296]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 5/13/2013 9:26:50 AM.
Project "C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServices\1.0\
Deployment\Deployment.btdfproj" on node 1 (Deploy target(s)).
SetWinVer:
  Running on Windows V61
  Detected IIS 7
  Detected 64-bit OS
GetSoftwarePaths:
  Using .NET Framework Install Path 'C:\Windows\Microsoft.NET\Framework\v4.0.30
  319'.
  Using BizTalk Install Path 'C:\Program Files (x86)\Microsoft BizTalk Server 2
  010\'.
  Using Deployment Framework Install Path 'C:\Program Files (x86)\Deployment Fr
  amework for BizTalk\5.0\'.
  Using Deployment Framework Tools Path 'C:\Program Files (x86)\Deployment Fram
  ework for BizTalk\5.0\Framework\DeployTools'.
  Using BizTalk ESB Toolkit Install Path 'C:\Program Files (x86)\Microsoft BizT
  alk ESB Toolkit 2.1\'.
ExportSettings:
  "C:\Program Files (x86)\Deployment Framework for BizTalk\5.0\Framework\Deploy
  Tools\EnvironmentSettingsExporter.exe" "C:\Program Files (x86)\BizTalkApps\CD
  M.BizTalk.EnterpriseServices\1.0\Deployment\EnvironmentSettings\SettingsFileG
  enerator.xml" "C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServi
  ces\1.0\Deployment\EnvironmentSettings"
  Environment Settings Spreadsheet to XML Exporter 1.6.1
  [http://EnvSettingsManager.codeplex.com]
  Copyright (C) 2007-11 Thomas F. Abraham.  All Rights Reserved.

  Importing from SettingsFileGenerator.xml...

  Output format is XmlPreprocess (multi-file).

  Exporting to DEV_Settings.xml...
  Exporting to QA_Settings.xml...
  Exporting to PROD_Settings.xml...

  Finished.
InitializeAppName:
  BizTalk Application Name is CDM.BizTalk.EnterpriseServices
InitSettingsFilePath:
  Invalid settings file path (OK on server undeploy).
PreprocessBindings:
  Clearing file attributes for 'PortBindings.xml'.
  "C:\Program Files (x86)\Deployment Framework for BizTalk\5.0\Framework\Deploy
  Tools\xmlpreprocess.exe" /f /v /c /noDirectives /i:"C:\Program Files (x86)\Bi
  zTalkApps\CDM.BizTalk.EnterpriseServices\1.0\Deployment\PortBindingsMaster.xm
  l" /o:"C:\Program Files (x86)\BizTalkApps\CDM.BizTalk.EnterpriseServices\1.0\
  Deployment\PortBindings.xml" /d:CurDir="C:\Program Files (x86)\BizTalkApps\CD
  M.BizTalk.EnterpriseServices\1.0" /s:""
  XmlPreprocess v2.0.13.0
  Copyright (c) 2004-2010 Loren M Halvorson
  XML File Preprocessor

  /s:: Argument expects a parameter
Coordinator
May 13, 2013 at 6:28 PM
The issue may be related to the way that you are trying to use $(Configuration). You have defined additional values for $(Configuration) of QA and PROD, but the Deployment Framework expects that on a server deployment using an MSI that $(Configuration) = Server. If you use a different value many steps will not be carried out properly. Where you pass Configuration=QA, you must instead pass Configuration=Server.

What are you trying to do with the QA and PROD values? There is probably a different way to accomplish the same thing without using $(Configuration). For example, you can put a setting named Environment into the settings spreadsheet, add Environment to the PropsFromEnvSettings ItemGroup, and then reference $(Environment) in the .btdfproj in place of $(Configuration).

Thanks,
Tom
May 13, 2013 at 6:55 PM
I was trying to use QA, PROD to select different Env settings file. I changed this to use Server Configuration and it started working fine. Since I was using powershell for running this I managed it from there.

Thanks for your help