c# - How to force the newer NuGet package version when there's a version conflict due to transitive references - Stack O

I have a solution with 5 projects:Project 1-3 are SDK-style projects with PackageReference.Project 4 i

I have a solution with 5 projects:

  • Project 1-3 are SDK-style projects with PackageReference.
  • Project 4 is a legacy .csproj project with packages.config (.NET Framework 4.7.2. WebForms + MVC 5 project that can't be upgraded).
  • Project 5 is a unit test project, MSTest, SDK-style with PackageReference. It contains tests for all the other projects and references them all.

Project 4 explicitly references Microsoft.IdentityModel.Tokens and Microsoft.IdentityModel.JsonWebTokens version 8.3.0.

Projects 1-3 are using third-party NuGet packages which apparently reference the same packages but version 6.35.0, so they get included as transitive.

Project 5, the test project, does not explicitly reference those two packages, but of course gets them brought in as transitive.

But I get warning MSB3277 "Found conflicts...", and it chooses to use version 6.35.0.

I'm not sure it matters, but I'd really like to get rid of the warnings, and I suppose I'd prefer to get it to use 8.3.0, since that's the version my own code uses (as opposed to 6.35.0, which is used only by third party code).

Is there any way I can get the test project to choose 8.3.0?

I did try adding a version redirect, but it didn't seem to work (unless I made some mistake when i tried). I also tried reading a few of the many MSB3277 questions here in SO to find any clues but I gave up.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744948536a4602772.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信