✅ Issue with Sdk Targeting Multiple Frameworks
Hi everyone. I'm creating a sdk that targets both .net 6 and .net 8 frameworks. The publishing works fine but when I add the sdk reference to .net 6 project it is giving me the following errors:
0>CSC: Error CS1705 : Assembly 'SDK' with identity 'SDK, Version=8.0.0.8, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
0>CSC: Error CS1705 : Assembly 'SDK' with identity 'SDK, Version=8.0.0.8, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.AspNetCore.Mvc.Core' with identity 'Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
17 Replies
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Would you like to see the csproj of the sdk or the referencing the sdk or both?
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Got it. Thanks
Attached is the csproj for the sdk
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Unfortunately - I won't be able to share the sdk. its in a private repo
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
how would you determine that?
In my runtimeconfig.json file for the .net package it is referencing .net8 frameworks
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Should I add the deps.json to this thread?
ok. the runtimeconfig I have included is for the sdk package and not the app referencing the sdk.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Firstly, sorry for my ignorance. The publishing of nuget packages is quite new to me, especially when it comes to debugging issues. Secondly, are you saying that the app that is referencing the sdk is the problem? It might be bringing in something that it shouldn't? If that is the case, why would it work with a single target nuget packag.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Ok. So the csproj, I attached in the beginning of our conversation was the sdk's csproj. It is dependent of another sdk which I probably incorrectly named as MY as well. (Lets name that MY2). MY2 has been branched off and created as two separate sdk's which is dependent on the target framework (.net 6 and .net 8). Both sdks have been tested with different apps.
Now, the sdk I'm trying to use, targets multiple target framework, as well as references the required packages dependent on the target framework. (as per attached csproj). BTW - there is no where in the csproj that is referencing System.Runtime (I've noticed there is a assembly as well as a nuget version of the same name)
We use the two commands to build and publish to the nuget
- dotnet build ./MY.csproj /p:Version=$CI_COMMIT_TAG --output out
- dotnet nuget push out/$PACKAGE_NAME.$CI_COMMIT_TAG.nupkg --source MY
When I add the MY sdk to a .NET 6 app, it is somehow referencing the System.Runtime version 8.
TeBeCo
TLDR: the package isn't net6 compliant
Quoted by
<@689473681302224947> from #Issue with Sdk Targeting Multiple Frameworks (click here)
React with ❌ to remove this embed.