C
C#9mo ago
Blaze

Reference a higher version of System.Runtime

Hello everyone, I'm making a .NET Framework (v4.8) and C# (v8.0) class library, I'm also using a library which requires me to reference System.Runtime 7.0.0.0 (while currently there is a v4.1.2.0 reference), which I'm clueless on how to do, any help is appreciated!
4 Replies
Pobiega
Pobiega9mo ago
If you are targetting both 4.8 and 8.0, that would mean you need to target .net standard 2.0 assuming you want the exact same codebase to work for both in a single library
Blaze
BlazeOP9mo ago
well, how exactly could i do that? changing the target framework in my .csproj to netstandard2.0 breaks (doesn't want to load the project), do i need to download it as an individulal component from the installer?
reflectronic
reflectronic9mo ago
System.Runtime 7.0.0.0 means that the library is compiled for .NET 7 you may not use a library compiled for .NET 7 from .NET Framework 4.8
Pobiega
Pobiega9mo ago
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

</Project>
is the bare minimum csproj file for a netstandard2.0 shouldnt need anything else afaik

Did you find this page helpful?