algorithmic modeling for Rhino
I'm getting and error ussing a component I write in VS2008. If I make the *.dll reference (3rth party app) as local copy in VS2008 everything works fine, but if I set local copy to "False" grasshopper tell me that is not possible to find the reference.
This is a mess because I need to copy the *.dll file into the *.gha folder.
Why there is no problem with GH or RH *.dll references?...
there is no problem with GH and RhinoCommon references because we resolve those issues when they occur. Basically, when the system needs a dll to run, it will first look in all the usual places, if it can't find it there it will raise an event, if nobody handles the event then the loading fails.
We made it fairly easy to register custom dlls, have a look at the Rhino.Runtime.AssemblyResolver class. It allows you to specify folders and files that ought to be taken into account when resolving non-standard assemblies.
Thanks for your fast and great reply. I'm reading the class documentation :) Fast and easy solution :D
Ok, I was playing with AssemblyResolver class but with no succes. Where is the correct place to declare "Rhino.Runtime.AssamblyResolver.AddSearchFile(...)"?
You have to add your search path before the assembly resolve failure. Basically, as early as possible. A good place to put this code would be in a GH_AssemblyPriority class:
Public Class AddReferencePriority
Public Overrides Function PriorityLoad() As GH_LoadingInstruction
Classes that derive from GH_AssemblyPriority are always loaded first by Grasshopper so the PriorityLoad() method is the first method in your dll/gha that gets executed.
Reference added :) Now everything works. Thanks for the help!