Version conflict and Exception when building

Hi All. I have a very amateur question.

I have Rhino installed which uses RhinoCommons 7.18.22124.3001. However I am using RhinoCommons 7.22 for plugin development.
Every time I build a project it comes up with an exception where it says:

		$exception	error CS1705: Assembly 'XXX' with identity 'XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 
'RhinoCommon, Version=7.22.22255.5001, Culture=neutral, PublicKeyToken=552281e97c755530' which has a higher version than referenced assembly 'RhinoCommon' with identity 
'RhinoCommon, Version=7.18.22124.3001, Culture=neutral, PublicKeyToken=552281e97c755530'	
 

How should I redirect the reference binding without updating Rhino? does that mean a plugin using the newer RhinoCommon dll would be incompatible with an older version Rhino7?

Hi @Wiley,

I see your project is using the RhinoCommon NuGet package.

You can install and use any version of RhinoCommon you want. In VS, just click Project > Manage NuGet Packages…

– Dale

1 Like

Thanks so much for your reply!! @dale


I have a latest Rhinocommon
My project is using RhinoCommons 7.22.22255.5001 and I wouldn’t want to downgrade it.

My Rhino is using 7.18.22124.3001 which i suspect the project is referencing instead.

My questions are:

  • I can upgrade my Rhino to 7.22.22255.5001, but does that mean all the users using the plugin would need to upgrade it to 7.22.22255.5001?
  • Is there a way to “force” the project to use an embeded RhinoCommon.dll (i.e. 7.22.22255.5001,)?

Hi @Wiley,

The version of RhinoCommon your plug-in project is referencing must be less than or equal to the version of RhinoCommon used by Rhino.

In your example, your plug-in is referencing RhinoCommon 7.22, but Rhino’s RhinoCommon is only 7.18. Thus, the plug-in will not load.

If you upgraded your Rhino to the same version of RhinoCommon referenced by your plug-in, then you plug-in will load.

Yes

I don’t understand, sorry.

Hope this helps.

– Dale

2 Likes

it clears things up!
Following up my second question, I was just browsing the internet to look for a solution and some came up with redirect binding reference. I guess this is irrelevant within this context though!

@dale
Sorry to resurrect this thread,
Is there a way in RhinoCommon to check what Rhino version the user has, so some codes that depends on the latest version won’t load?

Rhino.RhinoApp.Version property

HTH
Jeremy

1 Like

So as they elluded to earlier, Visual Studio doesn’t copy the RhinoCommon to the output folder during compilation, it relies upon you having the correct Rhino Version installed, which was the reason for your issue.

If your project is referencing/compiled with a NuGet version newer than the installed version of Rhino, your plugin will fail to load.

Binding redirects are generally done to move programs forward in version, not backwards so this wouldn’t work in your scenario.

You could create a helper plugin that is compiled against an older stable version of Rhino 7 (e.g. r20), and then have your helper plugin load the real plugin that is compiled against a newer version of Rhino, assuming their PC was running an appropriate version.

Another solution, which I use in our software is to create seperate .exe that does all of the work before starting Rhino with the necessary switches. So I validate all the requirements for our software with my .exe, this also allows me to more easily have a .exe with an Icon, and do other processes like check for updates, etc. The exe starts up, checks the installed versions of Rhino (Find the install in the Registry, Check the .exe version or the version key from the registry), then runs Rhino:

NOTE: We don’t use the “/NoSplash” switch, however our Skin suppresses the Splash Screen.

2 Likes

This is one of the most helpful answer I have received in this forum!
Thanks so much for sharing your insights!

1 Like