Created
November 20, 2016 16:13
-
-
Save nordinrahman/24644be1001cab67c9961ed046bf5d6f to your computer and use it in GitHub Desktop.
PropertyGroup element to define .NET constants
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup> | |
<NetFrameworkVersionNum>$(TargetFrameworkVersion.Replace("v", "").Replace(".", ""))</NetFrameworkVersionNum> | |
<!--Add an extra 0 if the version number is 40 or 45 so it can be compared to 401--> | |
<NetFrameworkVersionNum Condition="$(NetFrameworkVersionNum.Length) < 3">$(TargetFrameworkVersion.Replace("v", "").Replace(".", ""))0</NetFrameworkVersionNum> | |
<!--Don't define your own NET constants - this file will do it for you--> | |
<Error Condition=" $(DefineConstants.Contains('NET'))">Don't define your own NET constants</Error> | |
<!--Create a version to use with constants NET40, NET401 etc.--> | |
<NetFrameworkVersion Condition=" !$(DefineConstants.Contains(';NET')) ">$(TargetFrameworkVersion.Replace("v", "NET").Replace(".", ""))</NetFrameworkVersion> | |
<DefineConstants Condition=" !$(DefineConstants.Contains(';NET')) ">$(DefineConstants);$(NetFrameworkVersion)</DefineConstants> | |
<!--Define the OR_GREATER constants--> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 350">$(DefineConstants);NET35_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 400">$(DefineConstants);NET40_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 450">$(DefineConstants);NET45_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 451">$(DefineConstants);NET451_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 452">$(DefineConstants);NET452_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 460">$(DefineConstants);NET46_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 461">$(DefineConstants);NET461_OR_GREATER</DefineConstants> | |
<DefineConstants Condition="$(NetFrameworkVersionNum) >= 462">$(DefineConstants);NET462_OR_GREATER</DefineConstants> | |
</PropertyGroup> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment