Master copies of FilesToXmlPreProcess

Topics: Bindings File, Settings Management and SSO, Tips and Tricks
Dec 8, 2010 at 10:06 AM
Edited Dec 8, 2010 at 10:08 AM

I want to replicate the PortBindingsMaster.xml \ PortBinding.xml seperation approach with files in the FilesToXmlPreProcess list. 

For example, I would like an esbMaster.config to create an esb.config file with the tokens replaced. 

The justification for this is that I want to mitigate the risk of users checking in to source control a file that has already had the tokens replaced.

I cannot just add a copy command to the CustomDeployTarget as this happens after the PreprocessFiles target.

Do you have any advice on how to do this?

Coordinator
Dec 8, 2010 at 3:29 PM

In hindsight, I should have added an <OutputPath> next to <LocationPath> in <FilesToXmlPreProcess>...

  1. Add an AdditionalFiles ItemGroup to include your esbMaster.config into the MSI.
  2. Remove esbMaster.config from FilesToXmlPreProcess
  3. Go into BizTalkDeploymentFramework.targets (Program Files\MSBuild\DeploymentFrameworkForBizTalk\5.0) and locate the PreprocessFiles target.
  4. Copy one of the two <Exec> tasks for XmlPreprocess -- one is configured to require the XMLProcess directives in the source XML and the other allows "raw" tokens (see the XMLPreprocess documentation on that feature).  You can use whichever method you prefer.
  5. Paste the task into your CustomDeployTarget
  6. Change the paths in the /i and /o parameters to point to your master and output files.
  7. If you'd like to keep it more generic you can add to your .btdfproj your own custom ItemGroup modeled on FilesToXmlPreprocess, add the input and output path there, and reference the ItemGroup in the Exec task as seen in BizTalkDeploymentFramework.targets.  (see MSBuild documentation or the BizTalkDeploymentFramework.targets for examples)

That's probably the easiest way to work around the limitation.

Thanks,
Tom

 

Apr 25, 2012 at 1:25 PM

Thanks for the workaround advice.  But it would be great to have the <OutputPath> functionality you describe to make this easier.  I've raised an feature request for this: http://biztalkdeployment.codeplex.com/workitem/9357

Apr 25, 2012 at 6:21 PM

This feature has been implemented in version 5.0.
There is an OutputFilename metadata element on FilesToXmlPreprocess.
Tto get the token replacement to work, you should add the following MSBulid property:
   <RequireXmlPreprocessDirectives>false</RequireXmlPreprocessDirectives>

Coordinator
Apr 26, 2012 at 5:21 AM

Just to clarify, implemented in V5.0 RTW which is not yet released.  RequireXmlPreprocessDirectives can be true or false -- it just depends how you wish to handle the replacement metadata in the XML files (with or without XmlPreprocess directives).

Thanks,
Tom