在.NET Core 3.0 Preview9项目中使用System.Windows.Forms类 [英] Using System.Windows.Forms classes in a .net core 3.0 preview9 project

查看:390
本文介绍了在.NET Core 3.0 Preview9项目中使用System.Windows.Forms类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用



我错过了什么吗?

解决方案

您应该添加<

 < PropertyGroup>中的UseWindowsForms> true< / UseWindowsForms> 
< 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆