Question

I have a String resource that needs to have different value based on the conditional compile.

How to setup different Resources for different compile macros in Visual Studio 2008 Professional?

Was it helpful?

Solution

No can do. The resource string is stored in XML format in a .resx file, #ifdef doesn't apply. The Properties.Resources class is autogenerated, any #ifdef you put in the Designer.cs source code file will be lost when the file is re-generated.

Put the #ifdef in the code that retrieves the string. A small static helper method will do the job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top