Skip to content

Commit

Permalink
Optionally Disable .NET Framework's WinFX targets
Browse files Browse the repository at this point in the history
Only when targeting CoreCLR based frameworks
  • Loading branch information
Nirmal4G committed May 6, 2020
1 parent 28b3115 commit f3d89b5
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Project="Microsoft.NET.SupportedTargetFrameworks.props" />
</ImportGroup>

<!-- Workaround: https://github.com/microsoft/msbuild/issues/4948 -->
<PropertyGroup>
<ImportFrameworkWinFXTargets>false</ImportFrameworkWinFXTargets>
</PropertyGroup>

<PropertyGroup>
<_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true</_IsExecutable>
</PropertyGroup>
Expand Down Expand Up @@ -54,17 +49,23 @@ Copyright (c) .NET Foundation. All rights reserved.
<_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion.TrimStart('vV'))</_TargetFrameworkVersionWithoutV>
</PropertyGroup>

<!-- Check if the Target Framework is coreclr based -->
<PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == ''">
<_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</_IsNETCoreOrNETStandard>
<_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">true</_IsNETCoreOrNETStandard>
</PropertyGroup>

<!-- Workaround: https://github.com/microsoft/msbuild/issues/4948 -->
<PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == 'true'">
<ImportFrameworkWinFXTargets Condition="'$(ImportFrameworkWinFXTargets)' == ''">false</ImportFrameworkWinFXTargets>
</PropertyGroup>

<!--
Use RuntimeIdentifier to determine PlatformTarget.
Also, enforce that RuntimeIdentifier is always specified for .NETFramework executables.
-->
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.RuntimeIdentifierInference.targets" />

<PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == ''">
<_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</_IsNETCoreOrNETStandard>
<_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">true</_IsNETCoreOrNETStandard>
</PropertyGroup>

<!-- Unification / automatic binding redirect logic -->
<PropertyGroup>
<DesignTimeAutoUnify Condition="'$(DesignTimeAutoUnify)' == ''">true</DesignTimeAutoUnify>
Expand Down

0 comments on commit f3d89b5

Please sign in to comment.