I would like to add Microsoft System.Windows.Forms to a project.json used by dnx run on Ubuntu 14.04 Linux

I would like to add Microsoft System.Windows.Forms to a project.json used by dnx run on Ubuntu 14.04 Linux. My only constraint is that I cannot use exclusively mono components. When I tried mcs InteroperabilityTest.cs /target:winexe /r:System.Drawing,System.Windows.Formseverything compiled fine. But I want to avoid using the mcs compiler and use dnx's C# compiler instead.

The reason I want to use System.Windoiws.Forms.dll is to take advantage of its DataGridView control.

Here is my project.json. The version of .NET for Linux I wish to use is either 4.5.1 or 4.6 or the latest version(please tell me how to install it and its version number and long English name).

    "version": "1.0.0-rc1-15528",
   "dependencies": {
"commands": {
    "hi": "InteroperabilityTest"
 "frameworks": {
    "dotnet": {},
    "dnx451" : {},
   "dnxcore50": {
        "dependencies": {
            "Microsoft.CSharp": "4.0.0-beta-23019",
            "System.Net.Sockets": "4.0.10-beta-23019",
            "System.Text.Encoding": "4.0.10-beta-23019",
            "System.Collections": "4.0.10-beta-23019",
            "System.Xml.XDocument": "4.0.10-beta-23019"


Here is my dnx run error messages when I try to compile InteroperabilityTest.cs.

/home/frank/developmentMono/SmartCamXi_Hybrid/Recorder/InteroperabilityTest/InteroperabilityTest.cs(28,24): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'DataGridView' could not be found (are you missing a using directive or an assembly reference?)

Please scan this URL for the context of my question: http://stackoverflow.com/questions/31539341/project-json-definition-dnx451-vs-dotnet-4-51

Any help is greatly appreciated.
camster123Senior C++ Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
You can't.

System.Windows is already compiled and for Windows. Under the hood it uses native Windows functions that are not there or are very different on Linux. Low level code that runs the close to the OS deals a lot with messages, numerical values that are exchanged with the system (a double click is 206 hexadecimal or 518 decimal in Windows). These values are not the same in Linux.

This is what is compiled into the System.Windows.Forms.dll. Bring that to Linux, and the functions, parameters and constants are not the same, so the code won't work.

You can port .NET code between Windows and Linux because if is compiled to work with the framework, and you have in mono a Linux framework that copies most of the features of the Microsoft framework. Same names for classes, methods and properties. Same parameters for the methods. Same names for the constants.

But the framework itself, that includes System.Windows.Forms, addresses the operating system directly. And Linux and Windows are not the same. So pieces of one framework cannot be moved from one OS to another. They have to be recreated in Linux, which is what mono is all about.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
camster123Senior C++ Software EngineerAuthor Commented:
Jacques Bourgeois (James Burger) solved the problem I spent a whole day trying to solve yesterday. Is there a 3rd party library which implements a DataGridView  C# control which I can purchase or download? Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.