Home > Enterprise >  Use Different version of package for two nuget package C# .net framework
Use Different version of package for two nuget package C# .net framework

Time:06-29

I need to use to use two packages Package1 & Package2 both in same project (same .csproj file)

But both need different version of Bond.Core.CSharp how do i use both packages. Dependency is like:

Package1 -> dependency -> dependency -> dependency -> Bond.Runtime.Csharp 9.0.3-> Bond.Core.CSharp 9.0.3

Package2 -> dependency -> Bond.Runtime.Csharp 9.0.3-> Bond.Core.CSharp 9.0.3

<PackageReference Include="Package1" Version=.. /> 
   expect "Bond.Core.CSharp" Version="9.0.1"

<PackageReference Include="Package2" Version=.. /> 
   expect "Bond.Core.CSharp" Version="9.0.3" />

TargetFrameWork = .Net Framework 4.7.2

CodePudding user response:

If the first package requires 9.0.1 and the second 9.0.3, you can try requiring directly version 9.0.3 in you project. I would expect Package1 to be fine with the version you are already requiring.

In other words, add a PackageReference for the desired version of Bond.Runtime.Csharp in order to ease the resolution of conflicts.

  • Related