Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, April 26, 2018 6:06 AM
This question stems from https://social.msdn.microsoft.com/Forums/vstudio/en-US/ca02eb12-eee7-47c4-9096-bd5c10420aed/variable-conditional-compilation-tag-to-update-target-framework?forum=visualstudiogeneral&prof=required
so I have declared
<PropertyGroup Condition=" '$(TargetFramework)' == 'net471'">
<DefineConstants>WINDOWS</DefineConstants>
</PropertyGroup>
in .csproj to replace NET471 in #if NET471 in code. I want to do the same in .csproj as well.
I have tried in the .csproj to replace
< ItemGroupCondition="'$(TargetFramework)'=='NET471' ">
by
< ItemGroupCondition="'$(DefineConstants)'=='WINDOWS' ">
< ItemGroupCondition="'$(TargetFramework)'=='WINDOWS' ">
< ItemGroupCondition="'$(Configuration)'=='WINDOWS' ">
but it is not working as the NuGet packages are not reference in projects that depend on this project
Can anyone help me on this?
All replies (1)
Thursday, April 26, 2018 7:38 AM âś…Answered
I solved it with
<ItemGroup`` ``Condition``=``"$(DefineConstants.Contains('<DefineConstants>'))"``>
Can anyone verify this?
Reference: https://stackoverflow.com/questions/25456161/using-conditional-symbol-inside-csproj