Skip to content

Commit

Permalink
Disable .NET Framework's WinFX targets import (#4630)
Browse files Browse the repository at this point in the history
Only when the Windows Desktop SDK is used directly instead!

Example:

```xml
-<Project Sdk="Microsoft.NET.Sdk" />
+<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
```
  • Loading branch information
Nirmal4G authored Jun 4, 2021
1 parent a10d4b1 commit d26eaac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
15 changes: 13 additions & 2 deletions packaging/Microsoft.NET.Sdk.WindowsDesktop/Sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ Copyright (c) .NET Foundation. All rights reserved.
<_MicrosoftWindowsDesktopSdkImported>true</_MicrosoftWindowsDesktopSdkImported>
</PropertyGroup>

<!--
Workaround: https://github.com/microsoft/msbuild/issues/4948
Disable .NET Framework's inbox WinFX targets when using the SDK, since, we really don't use it's build logic
and is superseded by 'WindowsDesktop' SDK that provides it's own WinFX for both NETFX and CoreCLR targets.
Make it opt-out, just in case, if something fails or we don't want to use 'WindowsDesktop' SDK's version.
-->
<PropertyGroup>
<ImportFrameworkWinFXTargets Condition="'$(ImportFrameworkWinFXTargets)' == ''">false</ImportFrameworkWinFXTargets>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />

<!-- Set ImportWindowsDesktopTargets to force import WindowsDesktop Targets to enable pre 5.0 behavior.
Post 5.0, Microsoft.NET.Sdk.WindowsDesktop.props will always be imported by SDK
<!--
Set 'ImportWindowsDesktopTargets' to force import Windows Desktop targets to enable pre 5.0 behavior.
Post 5.0, 'Microsoft.NET.Sdk.WindowsDesktop.props' will always be imported by SDK
-->
<PropertyGroup>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,4 @@
<SupportedTargetFramework Remove="@(_UnsupportedNETCoreAppTargetFramework);@(_UnsupportedNETStandardTargetFramework);@(_UnsupportedNETFrameworkTargetFramework)" />
</ItemGroup>

<!--
Workaround: https://github.com/microsoft/msbuild/issues/4948
Disable .NET Framework's inbox WinFX targets when using the SDK, since, we really don't use it's build logic
and is superseded by 'WindowsDesktop' SDK that provides it's own WinFX for both NETFX and CoreCLR targets.
Make it opt-out, just in case, if something fails or we don't want to use 'WindowsDesktop' SDK's version.
-->
<PropertyGroup>
<ImportFrameworkWinFXTargets Condition="'$(ImportFrameworkWinFXTargets)' == ''">false</ImportFrameworkWinFXTargets>
</PropertyGroup>

</Project>

0 comments on commit d26eaac

Please sign in to comment.