Grasshopper

algorithmic modeling for Rhino

I only get plugin working if I make *.dll reference as local copy

Hi people!,

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?...

Thank you!

Views: 1048

Replies to This Discussion

Hi Angel,

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.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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

  Inherits GH_AssemblyPriority


  Public Overrides Function PriorityLoad() As GH_LoadingInstruction

    Rhino.Runtime.AssemblyResolver.AddSearchFile("mydllfilelocation")

    Return GH_LoadingInstruction.Proceed

  End Function
End Class

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.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Reference added :) Now everything works. Thanks for the help!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service