Preprocessing Files

Topics: General Questions
Aug 26, 2010 at 11:51 AM


Great job on the Framework. I have a question on the files preprocessing target. In the BizTalkDeploymentFramework.targets on lines 455 to 460 I see the following:

<ItemGroup Condition="'$(Configuration)' != 'Server' and '@(FilesToXmlPreprocess)' != ''">
    <FilesToXmlPreprocessQualified Include="@(FilesToXmlPreprocess->'%(LocationPath)\%(Identity)')" />
  <ItemGroup Condition="'$(Configuration)' == 'Server' and '@(FilesToXmlPreprocess)' != ''">
    <FilesToXmlPreprocessQualified Include="@(FilesToXmlPreprocess->'..\%(Identity)')" />

I am trying to preprocess a policy file but I don't want to break the preprocessing for other files. I've placed the Policy in <SOLUTIONLOCATION>\BRE\Policies folder to match the location it is placed during deployment. Then added this to my BTDFPROJ file.

  <FilesToXmlPreprocess Include="$(ProjectName).Policy.xml">
  <RulePolicies Include="$(ProjectName).Policy.xml">

So when the preprocessing occurs during deployment it cannot find the file because that file path is actually ..\BRE\Policies. Is there any specific reason why the Server configuration doesn't also use the LocationPath? Is there a better way to handle this?

Thanks in advance for your help,


Aug 26, 2010 at 4:49 PM
Edited Aug 26, 2010 at 4:50 PM

The reason that the server paths don't use LocationPath is packaging and control.  You could be pointing to file paths all over the place using the various LocationPath's.  When the server MSI builds, it needs to bring everything together into one known folder structure and package it up into the MSI.  Most extra XML files to be preprocessed are included into the MSI with the <AdditionalFiles> ItemGroup, which matches the path used by FilesToXmlPreprocess.

One thing you could do as a workaround (and a simple one at that) is:

  1. List your policy file in an <AdditionalFiles> ItemGroup.  That will cause a second copy of it to be included in the MSI in the install root folder.
  2. Keep your <FilesToXmlPreprocess> ItemGroup as-is.
  3. In a new target named CustomDeployTarget with Condition="'$(Configuration)' == 'Server'", include a <Copy> task to copy the policy XML from ..\$(ProjectName).Policy.xml (which will be preprocessed) to ..\BRE\Policies.

I think that will accomplish what you want without too much trouble.


Aug 27, 2010 at 6:06 PM


Thanks for your help. I've implemented the changes you suggested and it works perfectly.

Thanks again,


Nov 18, 2011 at 4:46 PM

Works great!  Thanks, Tom!