Type is defined in an assembly that is not referenced (Visual Studio with RhinoCommon) [Solved]


I have been trying to compile a visual studio project that contains a lot of Rhino Plugins lately and while I had a lot of errors at the beginning (around 400 compiler errors),

I managed to reduce almost all the errors. Mostly they were of the following type: “some external namespace” couldn’t be found. I then installed all the necessary nuget packages and visual studio extensions through the Visual Studio Gallery online (QuickGraph, Newtonsoft.Json, Eto.Forms, etc. for example) …

…and now I am down to only having one error which I can’t handle myself.

The compiler error I get is the following:

CS0012 - The type “DialogResult” is defined in an assembly that is not referenced. You must add a reference to assembly “System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089”.

It appears to me that the standard Windows.Forms Dialog namespaces are colliding with the Rhino.UI. Here is the code: The second line is underlined red.

var dlg = new Rhino.UI.OpenFileDialog { Title = "select file", DefaultExt = "json" };

I installed the RhinoCommon templates v5, I even added RhinoCommon.dll manually.
I have Rhino 5 for Windows installed as well. I am using Visual Studio 2015 with Xamarin (because we want cross platform GUI functionality).

I hope someone can help me fix this very Windows-specific issue (as it appears to be).


Hi Ivan,

Does your project reference the System.Windows.Forms assembly?

– Dale

1 Like

Dear Dale,

I’ve seen that you answer a lot of questions on this forum and I want to thank you for that.
And especially in this case, I want to thank you even more because you solved my issue!

So my guess is that the guys developing the project use Mac + Eto.Forms for ShowDialog and because they use a Mac, they don’t need to reference Windows.Forms obviously, but I need to do that and as you thought:
Yes, there was no such reference which I now added and boom, it works!

So thank you very much again Dale!

All the best,