How to use System.Windows.Forms in .NET Core class library -
i've created .net core class library , try build against net40 framework. want use clipboard class system.windows.forms assembly. how can this?
my project.json file:
{ "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 here there no such dll } } } }
all net40 specific code under net40 define. thoughts?
what need "frameworkassemblies"
, example:
"frameworks": { "netstandard1.6": { "dependencies": { "netstandard.library": "1.6.0" } }, "net40": { "frameworkassemblies": { "system.windows.forms": {} } } }
working clipboard
requires setting main thread sta, don't forget add [stathread]
main()
in application.
Comments
Post a Comment