Closed DanielAbalde closed 2 years ago
SharpGLTF toolkit nuget package is NetStandard2.0 so it is guaranteed to be compatible with net471, in fact, the unit tests of sharpgltf also run with net471
So this might be a problem in the configuration of your project. Usual things to check:
In general, the solution is to explicitly reference system.runtime 5.0.0.0, but by all means this should not be necessary if the project is correctly set.
Which Visual studio version are you using: recomended 2022, minimum 2019
v 2019.
your csproj is new sdk style? or old verbose style?
I don't know, what should I look for to find out? I created it as a .NET framework 4.8 project.
do you have explicit dependencies to system.runtime in your csproj?
No.
do you have dependencies that require system.runtime 4.1.2.0?
I don't think so, but I haven't found how to see it directly either. I tried to remove extra libraries and the error persisted.
I also tried installing this https://www.nuget.org/packages/System.Runtime.WindowsRuntime/5.0.0-preview.3.20214.6 and I got the same error.
system.runtime.windowsruntime has nothing to do with the issue and it will only mess your project even more.
Your project csproj should be created with the new sdk-style, because it has better support of automatic transitive dependencies.
The old csproj format, which is long and verbose, requires explicit references for everything you use, which indirectly cause a lot of conflicts if not carefully defined. I suspect your issues happen because your csproj is old style.
I create a new project like that but it doesn't work either.
I am referencing two libraries (Rhinocommon and Grasshopper) which just have a dependency .NET 4.8. Here you can see the .csproj file, hopefully you see something wrong:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Grasshopper">
<HintPath>..\..\..\..\..\Program Files\Rhino 7\Plug-ins\Grasshopper\Grasshopper.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="RhinoCommon">
<HintPath>..\..\..\..\..\Program Files\Rhino 7\System\RhinoCommon.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="SharpGLTF.Core">
<HintPath>..\..\..\source\repos\SharpGLTF-master\SharpGLTF-master\src\SharpGLTF.Core\bin\Debug\net5.0\SharpGLTF.Core.dll</HintPath>
</Reference>
<Reference Include="SharpGLTF.Toolkit">
<HintPath>..\..\..\source\repos\SharpGLTF-master\SharpGLTF-master\src\SharpGLTF.Toolkit\bin\Debug\net5.0\SharpGLTF.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y "$(TargetDir)$(ProjectName).dll" "$(TargetDir)$(ProjectName).gha"
copy /Y "$(TargetDir)$(ProjectName).dll" "$(USERPROFILE)\AppData\Roaming\Grasshopper\Libraries\$(ProjectName).gha"" />
</Target>
</Project>
I got:
Error CS1705 Assembly 'SharpGLTF.Toolkit' with identity 'SharpGLTF.Toolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
To begin with, you're referencing a net5.0 library from a net48 project. No wonder it's not working.
And you should include SharpGLTF as a packageReference, not as a direct DLL reference
And you should include SharpGLTF as a packageReference, not as a direct DLL reference
It was the first thing I tried and it did not appear. I tried again and I had the pre-release disabled. :/ It works now. Thank you very much!
Hi!
It won't let me use SharphGLTF.Toolkit within a .NET framework 4.7.1 project,
code:
error:
CS1705 Assembly 'SharpGLTF.Toolkit' with identity 'SharpGLTF.Toolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Some help please?
Thanks!