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>
Samarbeid med oss på GitHub
Du finner kilden for dette innholdet på GitHub. Der du også kan opprette og se gjennom problemer og pull-forespørsler. Hvis du vil ha mer informasjon, kan du se vår bidragsyterveiledning.