question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect warning about WindowsDesktop SDK

See original GitHub issue

I have a project that has some libraries/exe that use WPF and some that don’t. The ones that do use the WindowsDesktop SDK. The ones that don’t use the default SDK to prevent accidental WPF references.

I have a directory.build.props file that sets UseWPF to true so that I don’t need them in all places.

In Preview 7, I now get this warning:

1>C:\Program Files\dotnet\sdk\3.0.100-preview7-012503\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(340,5): warning NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.

That’s coming from Microsoft.NET.Sdk.DefaultItems.targets. The check is being too aggressive.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
vatsan-madhavancommented, Jun 19, 2019

We have seen two kinds of problem reports:

i. Failing to change Microsoft.NET.Sdk to Microsoft.NET.Sdk.WindowsDesktop, setting UseWpf (or UseWindowsForms) to true, and attempting to build/port a WPF app (which, unsurprisingly, fails to build as expected)

ii. Using Microsoft.NET.Sdk.WindowsDesktop, but failing to set UseWpf or UseWindowsForms to true. Again, fails to build as expected.

We wanted to add suppressible warnings to help with both scenarios. This addresses the first one.

1reaction
vatsan-madhavancommented, Jun 19, 2019
<PropertyGroup> 
 <MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NETSDK1107</MSBuildWarningsAsMessages>
</PropertyGroup>

That should do it, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I eliminate warning NETSDK1137 in a .NET 5 ...
NET 5. Warning NETSDK1137 It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of ...
Read more >
NETSDK1137: Don't use the Microsoft.NET.Sdk. ...
To resolve this error, modify your project file to have <Project Sdk="Microsoft.NET.Sdk"> instead of the WindowsDesktop SDK.
Read more >
Microsoft.NET.Sdk.WindowsDesktop is required to build ...
When compiling my EXE I am seeing a warning that says: warning NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows ...
Read more >
NET Core 3.0 WPF App - The SDK Microsoft. ...
Description Of Issue: I have a WPF app that uses the sdk Microsoft.NET.Sdk.WindowsDesktop and NET Core 3.0 Preview 7.
Read more >
Rider creates invalid project for ".NET Core / Desktop ...
I chose this project type, and set the target framework to ".NET Framework 4.7.2" (to get an SDK-style project, for easy later multi-targeting)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found