How to add conditional compilation in resx file in xml format?
Asked Answered
D

1

6

NET project in which I need to add contents in the resource file (which is an xml file) based on certain compilation symbols.

something like the following:

<xml ....>
<myNodes>

#if SOMECONDITION
<node1>
...
</node1>

#else
<node2>
...
</node2>

#endif
</myNodes>

Is this even possible to do? I know this doesn't follow the XML rules. Is there similar method to use Conditional Compilation and yet to adhere to XML rules?

Depreciable answered 21/11, 2012 at 19:17 Comment(0)
M
0

I am no 100% sure that this resolves your issue but you can try condition constructs. there is no such a Conditional Compilation in xml.

 <rule>
    <if>
         <condition var="''$(Configuration)'" operator="=;">Debug</condition>
            <!-- more conditions possible -->
        </conditions>
        <statements>
            <!-- put your tage here -->
            <node1> ... </node1>
        </statements>
    </if>
    <else>
        <node2>
        ...
        </node2>
    </else>
</rule>
Margaux answered 17/5, 2018 at 17:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.