I am trying to extract all conditional compilation constsants from a given project file. The file has several
PropertyGroup
elements like this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
My first attempts at Linq to Sql all gave me all nodes, or none. What queries can I run to:
(a) get all
DefineConstants
elements, but include their parent element in the query, because I need the
Condition
attribute, or
(b) get all
PropertyGroup
elements that have
DefineConstants
children and include this children.
I am trying to build a dictionary of conditional compilation constants, so next time you come across a constant like
DEVIL_FROG_POTATO_GREEN
, you can just pop open my dictionary window and read, or hopefully, write what it does for others.