Ben*_*nni 5 c# winforms .net-core .net-core-3.0
如何在.NET Core 3.0 WPF项目中使用诸如Screen之类的类?有适用于它们的.NET Core 3.0文档页面,因此我认为它应该可以工作。
VS和编译器告诉我,命名空间Forms不存在于中System.Windows,因此感觉类不在3.0 sdk中。
System.Windows.Formsnuget上没有软件包,“添加引用”对话框仅包含System_Windows_Forms对.net框架的引用,这听起来非常错误:
我想念什么吗?
Dan*_*ite 10
您应该添加<UseWindowsForms>true</UseWindowsForms>您的csproj。
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)