Conflict between Rhinocommon and Rhino3dmIO

Hello,

I am developing a Rhino plug-in that uses an other library I wrote before. The other library uses Rhino3dmIO to deal with 3D geometry.

When I try to call functions from the library within the plug-in, I get some errors:

The type ‘Plane’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Rhino3dmIO’

However, when I install Rhino3dmIO packet, I obviously get an error about the Type being in both RhinoCommon and Rhino3dmIO.

I am clearly missing something over here… Maybe I should cast all input/output from and to RhinoCommon ?

Any tips would be appreciated!

Thanks

Hi @Ayoub,

The obvious solution is to have your other library reference RhinoCommon. Is there some reason you don’t want to do this?

– Dale

Hey @dale,

Thanks for the answer. The reason is that I am using the same library in a standalone application as well as plugins for other software. Some of the users might not have Rhino installed.

Hi @Ayoub,

You can reference two versions of assemblies that have the same fully-qualified type names using the extern alias keywords.

However, you cannot just pass a RhinoCommon Point3d object, for example, to Rhino3dmIO, because they are not the same type.

@stevebaer, any suggestions?

– Dale

Dale is correct, you are going to need to compile your library twice with difference references. Once for the stand-alone application and once for the Rhino plug-in.

I see. Thanks for the answers!

I was actually trying do the same thing, too bad for the type compatibility.
It would be nice in the future to implement a .net interface to make thoses classes compatibles.

Hello, I have the same concern, as I develop a standalone version I use Rhino3dmIO which is great for my project. But It will be awesome to also be able to use the library I develop in Grasshopper. Having the flexibility of Grasshopper/Rhinoceros for super users and a standalone version for classical user is an ideal way of working.
So I am able to change the library (Rhino3dmIO or Rhinocommon) by hand inside Visual Studio. Is there a more clever to do ?
By the way thanks for all the libraries, tools that are available.

You can specify different references for different build configurations in a csproj.

1 Like

Thanks for the hint I will search how to do that.

1 Like

With the good keyword it seems I am near the good solution.
I will implement something like that
https://www.codeproject.com/articles/878581/specify-assembly-references-based-on-build-configu

https://www.automatetheplanet.com/specify-assembly-references-based-build-configuration-visual-studio/

Here an example of how I pick the right assembly based on operating system without using build configuration in case you ever run into the need for that (:

1 Like

@nathanletwory and @stevebaer thanks for your reply I am now able to output 2 differents dll or Exe depending on what I need. So I have the best of the 2 world (Dedicated stable software without Rhinoceros or research tool inside Rhinoceros/Grasshopper)
For who have the same problem as me, don’t forget to “unload the project” before changing the csproj. (right click on the name of the project)
Here the change inside the csproj file

 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_Rhino3dmIO|x86'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\x86\Debug_Rhino3dmIO\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Rhinocommon|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\Rhinocommon\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>

Do you need a 32bit build for your standalone version? We have just released a new version of our standalone library the runs on Windows, Mac, and Amazon Linux but only as 64bit at the moment.
https://www.nuget.org/packages/Rhino3dm/

Thanks I will try. Software development is not my speciality, I have many things to learn.

I just mentioned this because I saw that your standalone configuration was set for x86