MS Visual Studio 2013.
Both When
and ItemGroup
elements can to have the Condition
attribute (as I see in MSDN). But I get different results.
When $(CAD_Year)
is 2015, I expect the AcRibbon
will be not referensed to my project:
<ItemGroup Condition= "'$(CAD_Year)' < '2010'" >
<Reference Include="AcRibbon">
<HintPath>$(CAD_SDK_Location)$(Inc)AcRibbon.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
But I get unresolved reference in the Solution Browser for the AcRibbon
always.
But this variant works fine:
<Choose>
<When Condition= "'$(CAD_Year)' < '2010'">
<ItemGroup>
<Reference Include="AcRibbon">
<HintPath>$(CAD_SDK_Location)$(Inc)AcRibbon.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
At this case the AcRibbon
is referenced only when $(CAD_Year)
less than 2010.
Why I get the different results?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…