Search code examples
xsltvisual-studio-2013msbuildteamcityslowcheetah

Slowcheetah app.config pass parameters to transform file


I have following transform file app.Release.config to transform my app.config using SlowCheetah. How do I pass the BUILD_NUMBER from TeamCity so that the transform file replaces a particular xml elements value.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="MyApp.Data.Model" publicKeyToken="866d4a0fa0599fe0" culture="neutral" />
    <bindingRedirect name="MyApp.Data.Model.BR" oldVersion="0.0.0.0-$(BUILD_NUMBER)" newVersion="$(BUILD_NUMBER)" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
  </dependentAssembly>      
</assemblyBinding>

If I hard code the value then SlowCheetah does the transformation. But, I don't know how to pass in the build_number as a argument so that for each build I can replace the correct version.


Solution

  • I could not find a way to pass parameters to slowcheetah transform files. I'm using a XmlPoke Task to modify the contents of app.config.

    My answer for this can be found at this link