@@ -185,20 +185,28 @@ Copyright (c) .NET Foundation. All rights reserved.
185
185
</PropertyGroup >
186
186
187
187
<!-- Add conditional compilation symbols for the target framework (for example NET461, NETSTANDARD2_0, NETCOREAPP1_0) -->
188
- <PropertyGroup Condition =" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETPortable' and '$(TargetFrameworkIdentifier)' != ''" >
189
- <_FrameworkIdentifierForImplicitDefine >$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</_FrameworkIdentifierForImplicitDefine >
190
- <_FrameworkIdentifierForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " >NET</_FrameworkIdentifierForImplicitDefine >
191
- <VersionlessImplicitFrameworkDefine >$(_FrameworkIdentifierForImplicitDefine)</VersionlessImplicitFrameworkDefine >
192
- <_FrameworkIdentifierForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework'" >NET</_FrameworkIdentifierForImplicitDefine >
188
+ <Target Name =" GenerateTargetFrameworkDefineConstants"
189
+ Condition =" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETPortable' and '$(TargetFrameworkIdentifier)' != ''" >
190
+ <PropertyGroup >
191
+ <_FrameworkIdentifierForImplicitDefine >$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</_FrameworkIdentifierForImplicitDefine >
192
+ <_FrameworkIdentifierForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " >NET</_FrameworkIdentifierForImplicitDefine >
193
+ <VersionlessImplicitFrameworkDefine >$(_FrameworkIdentifierForImplicitDefine)</VersionlessImplicitFrameworkDefine >
194
+ <_FrameworkIdentifierForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework'" >NET</_FrameworkIdentifierForImplicitDefine >
193
195
194
- <_FrameworkVersionForImplicitDefine >$(TargetFrameworkVersion.TrimStart('vV'))</_FrameworkVersionForImplicitDefine >
195
- <_FrameworkVersionForImplicitDefine >$(_FrameworkVersionForImplicitDefine.Replace('.', '_'))</_FrameworkVersionForImplicitDefine >
196
- <_FrameworkVersionForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework'" >$(_FrameworkVersionForImplicitDefine.Replace('_', ''))</_FrameworkVersionForImplicitDefine >
196
+ <_FrameworkVersionForImplicitDefine >$(TargetFrameworkVersion.TrimStart('vV'))</_FrameworkVersionForImplicitDefine >
197
+ <_FrameworkVersionForImplicitDefine >$(_FrameworkVersionForImplicitDefine.Replace('.', '_'))</_FrameworkVersionForImplicitDefine >
198
+ <_FrameworkVersionForImplicitDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework'" >$(_FrameworkVersionForImplicitDefine.Replace('_', ''))</_FrameworkVersionForImplicitDefine >
197
199
198
- <ImplicitFrameworkDefine >$(_FrameworkIdentifierForImplicitDefine)$(_FrameworkVersionForImplicitDefine)</ImplicitFrameworkDefine >
200
+ <ImplicitFrameworkDefine >$(_FrameworkIdentifierForImplicitDefine)$(_FrameworkVersionForImplicitDefine)</ImplicitFrameworkDefine >
199
201
200
- <BackwardsCompatFrameworkDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))" >$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</BackwardsCompatFrameworkDefine >
201
- </PropertyGroup >
202
+ <BackwardsCompatFrameworkDefine Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))" >$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</BackwardsCompatFrameworkDefine >
203
+ </PropertyGroup >
204
+ <ItemGroup >
205
+ <_ImplicitDefineConstant Include =" $(VersionlessImplicitFrameworkDefine)" />
206
+ <_ImplicitDefineConstant Include =" $(ImplicitFrameworkDefine)" />
207
+ <_ImplicitDefineConstant Include =" $(BackwardsCompatFrameworkDefine)" />
208
+ </ItemGroup >
209
+ </Target >
202
210
203
211
<!-- Add conditional compilation symbols for the target platform (for example ANDROID, IOS, WINDOWS) -->
204
212
<Target Name =" GenerateTargetPlatformDefineConstants"
@@ -242,7 +250,7 @@ Copyright (c) .NET Foundation. All rights reserved.
242
250
<!-- Remove TRACE when DisableDiagnosticTracing is true -->
243
251
<Target Name =" _DisableDiagnosticTracing"
244
252
Condition =" '$(DisableDiagnosticTracing)' == 'true'"
245
- DependsOnTargets =" GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants"
253
+ DependsOnTargets =" GenerateTargetFrameworkDefineConstants; GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants"
246
254
BeforeTargets =" CoreCompile" >
247
255
<ItemGroup >
248
256
<_DefineConstantsWithoutTrace Include =" $(DefineConstants)" />
@@ -264,7 +272,7 @@ Copyright (c) .NET Foundation. All rights reserved.
264
272
-->
265
273
<Target Name =" AddImplicitDefineConstants"
266
274
Condition =" '$(DisableImplicitFrameworkDefines)' != 'true' "
267
- DependsOnTargets =" GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants;_DisableDiagnosticTracing"
275
+ DependsOnTargets =" GenerateTargetFrameworkDefineConstants; GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants;_DisableDiagnosticTracing"
268
276
AfterTargets =" PrepareForBuild" >
269
277
<PropertyGroup >
270
278
<DefineConstants Condition =" '@(_ImplicitDefineConstant)' != '' " >$(DefineConstants);@(_ImplicitDefineConstant)</DefineConstants >
0 commit comments