I’m working on a plugin that targets both Rhino 7 with .Net Framework 4.8 and Rhino 8 with .NET 7. I’m trying to update it to use Nuget packages for Rhino (and most other references). If I reference the 8.5 version of the Nuget package, Rhino 7 gives and error. If I reference the 7.35 version of the package, Rhino 7 runs fine but Rhino 8 gives an error. I haven’t tried the 8.5 version of the package and Rhino 8, I assume that will work. Does the Nuget package version need to match the Rhino version? Or should the latest package version work for everything.
Also, you’re documentation page for Nuget packages is from 2019. I think this needs to be updated for VS 2022.
Thanks Scott. I think I’ve got all of the stuff in those covered. The crux of the issue is, should a plugin built for .Net Framework 4.8 against the RhinoCommon 8.5 Nuget package load into Rhino 7. If no, then I need to setup my project to target different Nuget packages depending on the target. If yes, then I have some other incompatibility.
What I did in the past was to use conditional expressions in the C# project files:
<PropertyGroup>
<RhinoVersion>8</RhinoVersion> <!-- change here for Rhino 7 or 8 -->
</PropertyGroup>
<ItemGroup Condition=" '$(RhinoVersion)'=='8' ">
<PackageReference Include="RhinoCommon"
Version="8.5.24072.13001"
IncludeAssets="compile;build"/>
</ItemGroup>
<ItemGroup Condition=" '$(RhinoVersion)'=='7' ">
<PackageReference Include="RhinoCommon"
Version="7.35.23346.11001"
IncludeAssets="compile;build"/>
</ItemGroup>
Then, you change the RhinoVersion in one place in your project file, and all package references are resolved to the correct version. I did find, however, that it is best to unload the solution first, then make the version change, followed by reloading the solution and performing a full rebuild.