在 .net core 3.0 preview9 项目中使用 System.Windows.Forms 类 [英] Using System.Windows.Forms classes in a .net core 3.0 preview9 project
本文介绍了在 .net core 3.0 preview9 项目中使用 System.Windows.Forms 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何使用
我错过了什么吗?
解决方案
您应该在您的 csproj 中添加
.
<OutputType>WinExe</OutputType><TargetFramework>netcoreapp3.0</TargetFramework><UseWpf>true</UseWpf><UseWindowsForms>true</UseWindowsForms></PropertyGroup>
How can we use classes like Screen in a .NET Core 3.0 WPF project? There are documentation pages for .NET Core 3.0 for them, so I assumed it should work.
VS and the compiler tell me that the namespace Forms
does not exist in System.Windows
, so it feels like the classes are not in the 3.0 sdk.
There is no System.Windows.Forms
package on nuget, and the "Add reference" dialog has only a System_Windows_Forms
reference to the .net framework available, which sounds horribly wrong:
Am I missing something?
解决方案
You should add <UseWindowsForms>true</UseWindowsForms>
in your csproj.
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
这篇关于在 .net core 3.0 preview9 项目中使用 System.Windows.Forms 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文