How to force use of a specific package version using PackageReference


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="" />
<PackageReference Include="SecondNuget" Version="" />

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=, 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 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 on SecondNuget, instead of the attempted use of which I don't have?

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