Menu

#1 Use Project Conditional Symbols for <!-- ifdef ${XXX}-->

open
nobody
None
5
2006-12-26
2006-12-26
Anonymous
No

It would be brilliant if your XMLPrePro could use the project defined conditional compile symbols (e.g. csproj) for the purpose of defining properties. This would be the holy grail for those among us looking to have only one single place to define an environment setting for both code and XML. For example:
<!--ifdef${XXX}-->
#if(XXX)

Where XXX need to only be defined once. Since the project file (e.g. csproj) is the default for code-based conditional compiling, XMLProProcess could use this same settings file for the same purpose. Now I do understand that XMLPreProcess doesn't currently have access to the project file. So here is how this added feature could work:

1) Add an optional command line arg for ProjectPath
/p:"C:\\XYZ\\XYZ.csproj"

2) Parse the project file to find the tag named:
<DefineConstants>

example of the <DefineConstants> tag:
<DefineConstants>TRACE;DEBUG;XYZ</DefineConstants>)

3) Parse this tag's inner text and consider these
as defined settings.

This simple change would allow users to use
<!--ifdef${XYZ}-->

Where XYZ is a Conditional Symbol defined on the project property pages.

How cool would that be.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.