How to use System.Windows.Forms in .NET Core class library

僤鯓⒐⒋嵵緔 提交于 2019-11-28 12:10:52

What you need is "frameworkAssemblies", for example:

"frameworks": {
  "netstandard1.6": {
    "dependencies": {
      "NETStandard.Library": "1.6.0"
    }
  },
  "net40": {
    "frameworkAssemblies": {
      "System.Windows.Forms": {}
    }
  }
}

Working with Clipboard also requires setting the main thread as STA, so don't forget to add [STAThread] to Main() in your application.

Mixing frameworks is certainly one way to go - but then, why do you use .NET Core ?

But what you can do is port the mono implementation of System.Windows.Forms to NetStandard.
Such as here: https://github.com/ststeiger/System.CoreFX.Forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!