.btdfproj file token replacement

Topics: Getting Started/Beginner
Mar 7, 2013 at 1:57 PM
We have policy files that are different per environment and I've setup a property in the Exported_LocalSettings.xml, a placeholder for this property in the .btdfproj file and am item group with PropsFromEnvSettings in it. Whenever I deploy the application I can see the property value being set correctly, but it's not being replaced in the location path. The tool ignores the policy section and continues the deployment without error.

Snippet from "Exported_LocalSettings.xml"
<property name="PolicyLocation">..\..\Policies\Local\</property>
Snippets from ".btdfproj"
  <!--Policies to deploy -->
  <ItemGroup>
    <RulePolicies Include="VCI.ESB.ContractOrigination.Itinerary.COROffRampEndPoint.xml">
      <LocationPath>$(PolicyLocation)</LocationPath>
    </RulePolicies>
  </ItemGroup>
  <ItemGroup>
    <PropsFromEnvSettings Include="PolicyLocation" />
  </ItemGroup>
Log
SetPropertiesFromEnvironmentSettings:
Setting properties from environment settings file (D:\Projects\ADG3-EnterpriseArchitecture\VCIEnterprise\ESB\8353\VCI.ESB.COR\VCI.ESB.COR\VCI.ESB.ContractOrigination.Deployment\EnvironmentSettings\Exported_LocalSettings.xml)
Setting property to value '....\Policies\Local\'.
Mar 7, 2013 at 3:09 PM
I actually took a different approach similar to the PortBindingsMaster file and used XmlPreProcess to replace tokens instead of using separate files.
Coordinator
Mar 9, 2013 at 6:05 AM
That's generally the best solution. Just to follow up on your original issue -- the reason it did not work is MSBuild's order of evaluation. When MSBuild parses the .btdfproj, it parses and "materializes" those ItemGroups before it ever gets to the initial execution steps. It is too late to change the ItemGroup definitions by the time you get to the settings export and conversion into MSBuild properties. I believe that moving them below the Import still would not have helped.

Tom