Publishing RH and GH scripts

Hi Ehsan, is this likely to be fixed soon? Are there any work-arounds you could recommend? Many thanks :smiley:

There is a workaround. Run this C# script in the new script editor, when you have loaded rhino :smiley: This will download the Newtonsoft.Json from NuGet and will load into Rhino. The publishing should work after this is run

#r "nuget: Newtonsoft.Json, 13.0.1"
using Newtonsoft.Json;

I’m working on a fix for the bug

Hi Ehsan,

We are experiencing the same issue but unfortunately the workaround also didn’t work. (see screenshot)
Do you know how we can solve this?

Thanks,
Best Regards,
Victor

Hi @Victor_malek,

I’ve just replicated the solution @eirannejad suggested and it works on my machine.
Please close the project you’ve opened on your screenshot. Start a new C# file and run the code (I selected the last build from NuGet, 13.0.3).

Once downloaded, try opening and publishing the project again.

Regards,

1 Like

Hi Pedro,

Thanks for the feedback - it works indeed! Thanks again,

Best Regards,
Victor

Hello @eirannejad,

I followed the instructions, and the result still returned me an error:

@wacdemic0206 It’s a known bug. Still working on it :smiley:

RH-75990 Publishing fails due to missing Newtonsoft.Json

Yeah, I found a workaround.

Before doing “#r “nuget: Newtonsoft.Json, 13.0.1”
using Newtonsoft.Json;”, I need to find the “Newtonsoft.Json.dll” file on my PC and copy-paste it into the Rhino folder.

Same problem here. I tried the workarounds, it didn’t work.
When I try to do “nuget: Newtonsoft.jon 13.0.3”, I get what seem to be an error :

And I still can’t publish the project, with error “Failed getting NETFramework reference assemblies”

Another dirty workaround: Copy Newtonsoft.Json.dll to C:\Program Files\Rhino 8\System.

2 Likes

I still get “Failed getting NETFramework reference assemblies” even with Alexander’s trick on an up-to-date Rhino and Win10. Any other workaround?

Did you check the version of your "Newtonsoft.jon " file? (It could be 13.0.3 or 13.0.1 …or other)

I’ve tried matching the version of the Newtonsoft.jon file and modifying the code: #r “nuget: Newtonsoft.Json, 13.0.1” to match the same version of that file, and this strategy works for me.

1 Like

I got it to work, thanks! For future reference, this is how:

  • I downloaded the last version (13.0.3) of Newtonsoft Json directly from their Github page. The DLL is in the ZIP folder under Bin/net6.0.
  • Pasted it into Rhino “System” folder
  • Launched Rhino in Admin mode (don’t know if really necessary)
  • Ran #r "nuget: Newtonsoft.Json, 13.0.3" in the Script Editor

As a side note @eirannejad, I noticed that the Publish window doesn’t let you save the project or publish if the build folder is not empty …

1 Like

That usually happens when you have a grasshopper dll built using the project and have that already loaded in Grasshopper. Windows does not allow deleting those dlls to the build process fails. I have a ticket to improve the messaging:

RH-77167 Improve error reporting on the publish plugin window

Thanks for the answer. To be clear I do not have Grasshopper DLLs in my project, only Python scripts.

Ok so are there any grasshopper files under the Grasshopper/ in the project?

No there weren’t any Grasshopper file or folder, the project only had Python scripts.
For some reason, I don’t seem to be able to “replicate” the bug for now. I’ll keep you updated if it happens again.

1 Like