I have been coding in c#/vb under Grasshopper environment for quite some time, but I am pretty new to the Visual Studio environment, so sorry for the newbie questions.
I am trying to build a set of components(gha : do you typically call it an assembly?) that shares some classes to transfer data back and forth between the components.
I managed to set things up following the tutorial from the Rhino3d website as below. Then I added a class library called MyClassLibrary1 to save all my classes there.
What I got stuck with is how can I reference MyClassLibrary1 from MyComponents so I can use DrawCircle class? Or I am doing it the wrong way?
Thanks in advance.
Right click references on MyProject1 and add reference.
Then go to projects on the left side panel and select the library.
Fantastic. Thank you so much!
I thought if they are in the same solution, they would see each other. Then this way, it will produce gha and dll. Is it correct?
If you set the project to compile and rename to .gha during post build, then yes.
Right, you mean a gha that holds all components and a dll that has all the classes.
I was successfully reference the library but from my components, it is not still visible when I try using it. The class is public… Any idea?
Are you referencing the namespace of the class in the component?
This is done at the top of the .cs file with the using statement.
Yes, I was trying to reference the namespace… But I don’t see the namespace coming in after using.
Is the class library listed under the references of the project?
yeap. i can clearly see it.
Can you double click it to open it in the object browser?
That should show you the namespace of your class.
Ah, I think I got it to work. When I added a class library, I chose DotNet standard. With DotNet framework, it has just started working!