如何在.NET Core类库中使用System.Windows.Forms
发布时间:2020-12-14 04:18:47 所属栏目:Windows 来源:网络整理
导读:我已经创建了.NET Core类库并尝试针对net40框架构建它.我想从System. Windows.Forms程序集中使用Clipboard类.我怎样才能做到这一点? 我的project.json文件: { "version": "1.0.0-*","dependencies": { "NETStandard.Library": "1.6.0" },"frameworks": { "
我已经创建了.NET Core类库并尝试针对net40框架构建它.我想从System.
Windows.Forms程序集中使用Clipboard类.我怎样才能做到这一点?
我的project.json文件: { "version": "1.0.0-*","dependencies": { "NETStandard.Library": "1.6.0" },"frameworks": { "netstandard1.6": { "imports": "dnxcore50","buildOptions": { "define": [ "NETCORE" ] },"dependencies": { "System.Threading": "4.0.11","System.Threading.Thread": "4.0.0","System.Threading.Tasks": "4.0.11" } },"net40": { "buildOptions": { "define": [ "NET40" ] },"dependencies": { // dependency should be here but there is no such dll } } } } 我所有的net40特定代码都在NET40下定义.有什么想法吗?
你需要的是
"frameworkAssemblies" ,例如:
"frameworks": { "netstandard1.6": { "dependencies": { "NETStandard.Library": "1.6.0" } },"net40": { "frameworkAssemblies": { "System.Windows.Forms": {} } } } 使用剪贴板还需要将主线程设置为STA,因此不要忘记在应用程序中将[STAThread]添加到Main(). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows桌面应用程序和Windows应用商店应用程序有什么区别
- .net – 如何在PowerShell中引用UWP类
- windows – 测试用户帐户和密码的工具(测试登录)
- 为什么我的Emacs在Cygwin上运行Windows 7,总是创建崩溃转储
- .net – Windows Azure Active Directory – refreshtoken到
- 用户界面 – 在Windows上选择GUI(wxPy vs pyQt)
- Windows10 Powershell批量更改后缀名
- 从WIN32应用程序使用的C#COM DLL调用Java代码?
- 在为Windows操作系统中的大文件计算SHA-1哈希时,Python崩溃
- Plone-如何在注册表中为字典类型的记录创建控制面板?