0

I have an xml file that will have different values depending on the environment that it is deployed to. So far I have installed Slow Cheetah and it allowed me to do a transform on the xml file however I am not sure what syntax to use since it is different from a config file.

Here is what I have so far: AppConfig.Dev.xml

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
 see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<config xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

    <application name="HSMED">
        <appHost>dev</appHost>  //not sure how to specify transform
    </application>
</config>
TheProgrammer
  • 1,314
  • 5
  • 22
  • 44

1 Answers1

0

The syntax is the same as used for .config files. Config files are also written in XML so it should work correctly. I've given a sample just in case.

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<config xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <application name="HSMED">
        <appHost xdt:Transform="Replace">PROD</appHost>
    </application>
</config>

If you want to verify this you could also check out the csproj file and make sure it looks something like this. I noticed that slowcheetah adds the DependentUpon and TransformOnBuild child tags to files when you enable them for transformation. Not sure why though.

<None Include="Config\somefile.Prod.xml">
  <DependentUpon>somefile.xml</DependentUpon>
  <IsTransformFile>True</IsTransformFile>
</None>
<Content Include="Config\somefile.xml">
  <TransformOnBuild>true</TransformOnBuild>
</Content>
Vignesh
  • 504
  • 5
  • 13