# Cannot load assembly

**URL:** <https://discourse.mcneel.com/t/cannot-load-assembly/80965>\
**Category:** Grasshopper Developer\
**Tags:** grasshopper, csharp\
**Created:** [March 27, 2019, 5:04pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965 "2019-03-27T17:04:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rawitscher-torres](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rawitscher-torres/32/159606_2.png) [@rawitscher-torres](https://discourse.mcneel.com/u/rawitscher-torres)\
**Post date:** [March 27, 2019, 5:04pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965/1 "2019-03-27T17:04:26Z")

</div>

Hi Guys,

I currently have 2 projects under the same solution file in Visual Studio. One where I have all my classes and namespaces and the other project is specifically to integrate it with Grasshopper. In my current class that inherits from `GH_Component` I am referencing my `.dll Assembly` for usage. I have a small issue which is when I build the Component, Grasshopper cant find my `.dll Assemebly`. A very bad work around that I am doing at the moment is to copy paste the `.dll` in to the special folders. I want to know how can I make Grasshopper automatically recognize the `.dll`. I have tried some solutions offered here [Coff and Grasshoppper](https://discourse.mcneel.com/t/coff-and-grasshoppper/74883) but it did not seem to work. I also added

`[assembly: Grasshopper.Kernel.GH_Loading(Grasshopper.Kernel.GH_LoadingDemand.ForceDirect)]`

in to the `AssemblyInfo.cs` of each project but it didn’t work either.

Just for some illustration…

```
using SharpMatter.SharpField; // When the component loads in grasshopper it cant find this assembly

namespace SharpMatter.SharpMatterGH.Components
{
    public class ReactionDiffusion2D_GH : GH_Component
    {

        SharpField2D<double> sharpField2D;

/////// bla bla

```

Any clues would be great.

Thanks

Nicholas

---

<div class="post-metadata">

**Author:** ![DavidRutten](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/davidrutten/32/755688_2.png) [@DavidRutten](https://discourse.mcneel.com/u/DavidRutten)\
**Post date:** [March 27, 2019, 5:48pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965/2 "2019-03-27T17:48:03Z")

</div>

Is that dll located in the same folder as the gha file?

---

<div class="post-metadata">

**Author:** ![rawitscher-torres](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rawitscher-torres/32/159606_2.png) [@rawitscher-torres](https://discourse.mcneel.com/u/rawitscher-torres)\
**Post date:** [March 27, 2019, 6:17pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965/3 "2019-03-27T18:17:34Z")

</div>

Hi David,

thanks for your reply. Yes, when I build from VS, 2 copies of the `.dll` are made, one in the `SharpMatterGH` project and one in the `SharpMatter project` In the images you can ignore the SharpMatterGH.gha file, now I am building it directly to `AppData\Roaming\Grasshopper\Libraries`  
.

 ![a2](https://global.discourse-cdn.com/mcneel/original/3X/d/6/d653d43b85f1e837d0a27dc3c754a84a1c4508b3.png) ![b2](https://global.discourse-cdn.com/mcneel/original/3X/1/7/17fad3391bdb16d347d7c164db8a8bec002cabb0.png)

---

<div class="post-metadata">

**Author:** ![Petras\_Vestartas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/petras_vestartas/32/480531_2.png) [@Petras\_Vestartas](https://discourse.mcneel.com/u/Petras_Vestartas)\
**Post date:** [March 27, 2019, 8:40pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965/4 "2019-03-27T20:40:08Z")

</div>

If you build both .dll and .gha files to the grasshopper libraries folder it should work.  
As it is the only way the grasshopper load the files.

---

<div class="post-metadata">

**Author:** ![rawitscher-torres](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rawitscher-torres/32/159606_2.png) [@rawitscher-torres](https://discourse.mcneel.com/u/rawitscher-torres)\
**Post date:** [March 27, 2019, 8:50pm UTC](https://discourse.mcneel.com/t/cannot-load-assembly/80965/5 "2019-03-27T20:50:50Z")

</div>

Hey Petras,

Indeed, that was the solution, should have thought about that one!
