How to force use of a specific package version using PackageReference

0

I seem to have a problem I can't solve.

I have a .NET Core 2.0 console app. This app requires a niche-nuget package that I only have available locally. Let's call it NicheNuget.

Both the console app and the NicheNuget package depends on a second package that we can call SecondNuget. This SecondNuget is also a package that I only have locally, and only have one version of.

My console app reference these packages:

<PackageReference Include="NicheNuget" Version="1.0.0.8" />
<PackageReference Include="SecondNuget" Version="0.0.0.45" />

Everything compiles, and all is splendid right until my console app tries to use SecondNuget:

system.IO.FileLoadException: Could not load file or assembly 'NicheNuget, Version=2.0.0.1, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I'm absolutely 200% sure that neither my console app or any project that I have attempts to get a version 2.0.0.1 of NicheNuget. And I can use the NicheNuget package just fine through my console app. SecondNuget however doesn't play nice. The second I call a class that makes use of SecondNuget, I will get the FileLoadException. This leads me to believe that it is SecondNuget that is trying to find NicheNuget with a version that I don't have.

SecondNuget should run just fine with the version I have of NicheNuget. I know they're compatible. What I'm entirely lost on is:

**How can I force the use of NicheNuget version 1.0.0.8 on SecondNuget, instead of the attempted use of 2.0.0.1 which I don't have?

c#
.net-core
nuget-package
packagereference
asked on Stack Overflow Oct 23, 2019 by Treeline

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0