This project is read-only.
1
Vote

#if directives with replacements don't work

description

In our scenario we have a single server in a load balanced environment that needs a section enabled, and that section also has replacements that need to be made. The below example demonstrates what I'm talking about:
 
<configuration>
<appSettings>
<!-- #define ${XPath=/configuration/appSettings/add[@key="Test"]/@value} = ${TestValue} -->
<!-- #if ${EnableTestSetting} -->
<!-- <add key="Test" value="1"> -->
<!-- #endif -->
</appSettings>
</configuration>
 
In the above example, assume EnableTestSetting has been provided with a value other than #undef. Also, assume the TestValue value in the XML file contains the value '2'. Below is the resulting file:
 
<configuration>
<appSettings>
<!-- #define ${XPath=/configuration/appSettings/add[@key="Test"]/@value} = ${TestValue} -->
<!-- #if ${EnableTestSetting} -->
<!-- <add key="Test" value="1"> -->
<!-- #else -->
<add key="Test" value="1">
<!-- #endif -->
</appSettings>
</configuration>

comments

jeff_winn wrote Jun 17, 2011 at 3:52 PM

Close the work item, I had mistyped the @value setting we had used. Sorry!

wrote Feb 14, 2013 at 7:04 PM