Reference Assembly warning

Hi,

We build our Grasshopper plugin against service release zero (typically).
If I reference our .gha in a script component, there is a warning flagged as per this image.

It’s not great to see orange components on the canvas when no actual conflict between versions occur. Is there any way to reference without the warning?

Thanks,

Jon

https://developer.rhino3d.com/api/grasshopper/html/M_Grasshopper_Kernel_GH_Component_ClearRuntimeMessages.htm

Thanks, but I was hoping to suppress this particular warning without suppressing all warnings and messages.

Not sure what the entire warning says, but have you done as it seems to suggest? (MS docs on CS1701)

1 Like

I’m not sure, I don’t compile any of the grasshopper or rhinocommon dlls, and my projects simply refer to SR0 versions. As Rhino and Grasshopper load the dlls prior to my plugin, if there was a version conflict there would be a different runtime error (but McNeel don’t tend to break compatibility).

I don’t know how often scripts reference loaded rhino/grasshopper plugins, but I would have thought it would be common the plugin is built against an earlier version. I don’t recall seeing this warning flagged in older versions of Grasshopper, but I haven’t rolled back to check this.

This isn’t a big deal, but as I mention, it’s not ideal to see an orange component with warnings when it isn’t causing problems. If anyone has other suggestions, that’s great.

Thanks,

Jon

I think those changes are made to your project, not RhinoCommon.

If none of that works, you can always iterate over all messages, collect the ones you want to keep, clear the whole list, then add the remainder back.

Here is a sample gh script, and a c# project to create a dll representative of the situation with my plugin.

testRhinoCommonReference.zip (212.6 KB)

I expect this situation might be common (ie Rhino updated since the script/plugin was created) and as mentioned, I don’t recall this warning being shown in the past.

Thanks for any guidance,

Jon

Pretty sure that started with Rhino 6. And I have the same issues, would be very interested how this can be fixed.

I am not sure if I understand that Microsoft link, but it seems that would imply that everytime I reference my custom assembly in a c#-script i have to include some version management code into that c# script, to make sure that there are not warnings all over the place?

1 Like

Hi Jon,

Not sure if this is related or if it makes a difference, but I highly recommend upgrading to PackageReference in your csproj. This helped me evade a lot of nuget troubles up to now.

Quick fix: right click package.config in visual studio, click upgrade to packagereference. There is also an option in visual studio to use PackageReference as a default.

Would this make a difference for you?

Could you be more specific? What do you have to add where in an assembly (.gha) if you don’t want those warnings to be thrown when the c# scripts are compiled?

How is this something I (as a user) can do? I don’t really understand what I would have to do where, but it seems to me I’d have to access the compile settings of the c# script? Where can I supply a “Runtime policy” ?
If I understand the warning correctly, it appears because the plugin (which is referenced in the assembly) is compiled against an older version of RhinoCommon.dll, so the compiler of the script sees a version conflict. How could I transport that information within a .gha-file? Is this a setting in Visual studio? Does this go in the AssemblyInfo.cs ?