AssemblyInfo Guids between Food4Rhino, Rhino, Grasshopper, Yak files

When creating an accompanying set of plugins for Rhino and Grasshopper (or seperately), there are quite a lot of places where Guids seem important. It is for me not very transparent how or when they are used.

Rhino project:

  • in your Properties/AssemblyInfo.cs you can define a Guid
    [assembly: Guid("%GuidForRhinoRhp%")]

Grasshopper project:

  • in your Properties/AssemblyInfo.cs you can define a Guid
    [assembly: Guid("%GuidForGrasshopperGha%")]

  • in thee class that derives from GH_AssemblyInfo, with a Guid
    public override Guid Id => new Guid("%GuidForGrasshopperAssemlbyInfo%");

  • For yak: you somehow need to specify this in the manifest.yml file. The documentation specifies it looks for a the AssemblyInfo.cs for Rhino, and for the GH_AssemblyInfo for Grasshopper. Does that mean that they should be same when combinding both?

  • For food4rhino, the field specifies only specifies GUID: when and or where would this id be used?

My questions are:

  • Are all these 3 relevant?
  • Can all these 3 be the same?
  • Should they be the same?
  • What would be the concequences of a guid changing?
  • In what scenarios are these 3 guids relevant?
1 Like

Hey Arend,

For Rhino and Grashopper plug-ins, GUIDs are used to ensure that only one version of a plug-in is loaded at any one time.

  • For Rhino (RhinoCommon) plug-ins, the GUID of the assembly is used (Properties/AssemblyInfo.cs).
  • For Grasshopper plug-ins, we use the Id property of the class that derives from GH_AssemblyInfo. If the plug-in author doesn’t provide this class, then a GUID is generated from the assembly’s name.

The package manager uses the Grasshopper plug-in’s GUID as a fallback during package restore for situations where a plug-in and its package do not share the same name. It was my intention to silently extract the Grasshopper plug-ins GUID during package authoring (hence “secret”…). Initially it was injected during yak build, but later I added it to yak spec too which may have caused confusion. The RHP’s GUID isn’t currently used for anything.

Unfortunately there’s currently a bug in the spec and build commands where, if present, the RHP’s GUID will be inserted into the manifest.yml file instead of the GHA. I’ll try to get that fixed ASAP… For now, if you manually edit the manifest.yml file to include the GHA’s GUID, yak build will not overwrite it.

I’m not sure about Food4Rhino myself. @fran, can you explain what the GUID field is used for?

1 Like

Thanks a lot for your quick and in-depth replyt! As a follow up: how does yak handle packages that contain both a rhp and gha? Should the GH_AssemblyInfo guid be the same as the rhp AssemlbyInfo guid?

Aside from the issue I mentioned above, packaging a GHA and an RHP together is no problem at all. Rhino and Grasshopper both have their own plug-in loading routines that include searching the contents of installed packages. Make sure that any .gha and .rhp files are in the root of the package, as neither of these loading routines will recurse into subdirectories.

There’s no requirement for these GUIDs to be the same.

1 Like