How to modify referenced assemblies in a C# script component with another C# script component

Hello

you must have ScriptComponents.gha referenced in the component.

    foreach(var obj in GrasshopperDocument.Objects)
    {
      var script = obj as ScriptComponents.Component_AbstractScript;
      if ( script != null && script.NickName == "UniqueName" )
      {
        switch ( version )
        {
          case "1.0.0":
            path = "Path/to/version-1.0.0.dll";
            break;
          case "1.1.0":
            path = "Path/to/version-1.1.0.gha";
            break;
        }
        if ( !script.ScriptSource.References.Contains(path) )
        {
          script.ScriptSource.References.Add(path);
          script.ScriptAssembly = null;
          //script.ExpireSolution(true)
        }
      }
1 Like