FilesToXmlPreprocess , no /c argument passed?

Topics: Bindings File, Settings Management and SSO
Aug 23, 2011 at 5:11 PM
Edited Aug 23, 2011 at 5:13 PM

I want to set up a process to run some xml pre-processing on the BizTalk configuration files. There are no errors during the process (ran from deploy after installing msi) and the file OutputFilename is generated but was not actually preprocessed (the preprocess markup remains).

If I look at the log file I see both Master.BTSNTSvc.exe.config and Master.BTSNTSvc64.exe.config getting processed by xmlpreprocess.exe. If I compare the the run performed for the PortBindingsMaster and compare it to the others I added the only difference I see is a /c arg passed to to xmlpreprocess.exe. If I copy the command line for Master.BTSNTSvc.exe.config and run it with the /c added it works as expected with all the replacements.

What could I be doing wrong in the btdfproj? Below is all of the relevant parts of the btdfproj ...

 

 

<EnableXmlPreprocess>true</EnableXmlPreprocess>

...

  <!-- AdditionalFiles -->
  <ItemGroup>
    <AdditionalFiles Include="Master.BTSNTSvc.exe.config">
      <LocationPath>..\Configurations</LocationPath>
    </AdditionalFiles>
    <AdditionalFiles Include="Master.BTSNTSvc64.exe.config">
      <LocationPath>..\Configurations</LocationPath>
    </AdditionalFiles>
  </ItemGroup>

  <!-- FilesToXmlPreprocess -->
  <ItemGroup>
    <FilesToXmlPreprocess Include="Master.BTSNTSvc.exe.config">
      <OutputFilename>BTSNTSvc.exe.config</OutputFilename>
    </FilesToXmlPreprocess>
    <FilesToXmlPreprocess Include="Master.BTSNTSvc64.exe.config">
      <OutputFilename>BTSNTSvc64.exe.config</OutputFilename>
    </FilesToXmlPreprocess>
  </ItemGroup>

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

  <Target Name="CustomPostDeployTarget">
    <Copy DestinationFolder="$(BtsDir)" SourceFiles="BTSNTSvc.exe.config" />
    <Copy DestinationFolder="$(BtsDir)" SourceFiles="BTSNTSvc64.exe.config" />
  </Target>
Coordinator
Aug 23, 2011 at 6:34 PM

That's the purpose of /c, to strip all preprocessor comments.  It may make sense for me to use it by default in every case instead of just on binding files.

You can also set RequireXmlPreprocessDirectives to true in your .btdfproj, in which case you do not need to include the ifdef preprocessor comments at all.  If you need to include or exclude blocks of XML then that's not an option, but if you're just substituting in values then it tends to be cleaner and simpler.  When it's true, the processing will just replace macros (like ${aValue}).

Are you saying that you're not even seeing the macros replaced?

Thanks,
Tom

Aug 23, 2011 at 7:05 PM

Thank you for your quick reply!

Exactly. To test it I'm just plugging in a line used in the PortBindingsMaster to make sure the file gets processed in general before spending time putting what is actually needed in.

 


... </channels> </application> </system.runtime.remoting> <!-- ifdef ${_xml_preprocess} --> <!-- <Host Name="${Xlang_Host}" NTGroupName="${ApplicationUsers_NTGroupName}" Type="1" Trusted="false" /> --> <!-- else --> <Host Name="BizTalkServerApplication" NTGroupName="HISNT\BizTalk Application Users" Type="1" Trusted="false" /> <!-- endif --> </configuration>

 

But when adding the /c switch ...

...
      </channels>
    </application>
  </system.runtime.remoting>
  <Host Name="BizTalkServerApplication" NTGroupName="HISNT\BizTalk Application Users" Type="1" Trusted="false" />
</configuration>

 

 

      </channels>
    </application>
  </system.runtime.remoting>
  <!-- ifdef ${_xml_preprocess} -->
  <!-- <Host Name="${Xlang_Host}" NTGroupName="${ApplicationUsers_NTGroupName}" Type="1" Trusted="false" /> -->
  <!-- else -->
  <Host Name="BizTalkServerApplication" NTGroupName="HISNT\BizTalk Application Users" Type="1" Trusted="false" />
  <!-- endif -->
</configuration>
Coordinator
Aug 23, 2011 at 8:14 PM
Edited Aug 26, 2011 at 3:35 AM

The system default of RequireXmlPreprocessDirectives is true, but it is set to false in projects created with the new project wizard.  Have you tried replacing that entire block between </system.runtime.remoting> and </configuration> with <Host Name="${Xlang_Host}" NTGroupName="${ApplicationUsers_NTGroupName}" Type="1" Trusted="false" />?

Thanks,
Tom