NETSDK1136: The target framework must be Windows
If UseWindowsForms
or UseWPF
is true
, .NET assumes that your project is a Windows app, and so the platform has to be set to Windows. This error can happen if you have a project-to-project reference where one is set to Windows and the other is not. The full error message is similar to the following example:
The target platform must be set to Windows (usually by including
-windows
in theTargetFramework
property) when using Windows Forms or WPF, or referencing projects or packages that do so.
For example, set TargetFramework
to net6.0-windows
, as shown in this project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
</Project>
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.