I have the following warning in a WPF program that used to be built for .NET Framework 4.5 but is now being built for .NET 5.
Warning NETSDK1137 It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK.
Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'.
ListEditor
C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets 376
Clicking the warning opens the file Microsoft.NET.Sdk.DefaultItems.targets
at line 376. This file starts with a comment that says DO NOT MODIFY
.
<!--
***********************************************************************************************
Microsoft.NET.Sdk.DefaultItems.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
Line 376 falls in this XML element...
<Target Name="_CheckForUnnecessaryWindowsDesktopSDK"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(_TargetFrameworkVersionWithoutV), '5.0')) and '$(_MicrosoftWindowsDesktopSdkImported)' == 'true' and '$(TargetFrameworks)' == ''">
<NETSdkWarning ResourceName="UnnecessaryWindowsDesktopSDK" />
</Target>
There is a Project element that encloses the entire file. The element is this...
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...omissions...
</Project>
Since that element does not mention Microsoft.NET.Sdk.WindowsDesktop SDK
the Project element does not seem to be the point at which the replacement Microsoft.NET.Sdk
should be placed.
How do I eliminate the cause of this warning?