1

I am running a solution where there a multiple nuget packages being used. In my "domain" nuget, I specify the following interface:

(in file: ecnugget.domain, nuget version is set to 1.0.10):

    public interface IItemPriceStore
    {
        Task<bool> AddPriceUpdateAsync(PriceUpdate priceUpdate);

        Task<bool> InitializeAsync();

        Task<IEnumerable<PriceUpdate>> GetByItemName(string itemName);
    }

The two last methods do not exist in version 1.0.7 of the nuget package, but they were added for version 1.0.10 of the same.

Now, in an implementation, I have updated the reference to version 1.0.10, and expect to see a build error, because the class ItemPriceStore does not yet implement the two new methods, however, it still builds! When I F12 the interface, I see this:

#region Assembly ecnugget.domain, Version=1.0.7.0, Culture=neutral, PublicKeyToken=null
// C:\Users\pedro\.nuget\packages\ecnugget.domain\1.0.10\lib\netcoreapp3.1\ecnugget.domain.dll
#endregion

using digitaldias.ec.domain.Entities;
using System.Threading.Tasks;

namespace digitaldias.ec.domain.Contracts.Writers
{
    public interface IItemPriceStore
    {
        Task<bool> AddPriceUpdateAsync(PriceUpdate priceUpdate);
    }
}

And I cannot for the life of me, figure out why or what is referencing the old 1.0.7 version. Things that I've tried:

  • Remove reference to the package and reinstall/rebuild
  • Cleared the package cache
  • Delete all packages
  • Delete nuget.config
  • Delete temporary folder where the metadata is stored
  • Delete all .suo files
  • Delete the .vs folder entirely

I have done all of this with restarts of Visual studio inbetween, or even with all instances of Visual studio closed.

My .csproj ONLY references version 1.0.10 of this package, and yet, for some mysterious reason, when I build, it keeps creating a metadatareference to version 1.07. I cannot for the life of me, figure out where 1.0.7 is referenced. I can't find it in any of the source files!

Here is the references in my current .csproj where I am implementing the interface:

    <ItemGroup>      
      <PackageReference Include="ecnugget.domain" Version="1.0.10" />      
      <PackageReference Include="PubSub" Version="4.0.1" />
      <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
    </ItemGroup>

Hoping that someone has some experience with the same and can help me.

Pedro G. Dias
  • 3,162
  • 1
  • 18
  • 30
  • 1
    Is it possible, that package with version `1.0.10` can contain dll with version `1.0.7.0`, do you have control over it? Can you download the package separately, unpack and check? – Pavel Anikhouski May 17 '20 at 15:12
  • 1
    Yes, this was the case! For some reason, when I set the package version to 1.0.10, the assemblyversion still remained at 1.0.7! I made a new version 1.0.11 where assembly versions match, and the problem was solved. Thank you! – Pedro G. Dias May 18 '20 at 03:10

1 Answers1

0

Just a hint, see this thread .

Try enabling auto binding redirection. Add this in your .csproj file

<PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
Khaled
  • 317
  • 2
  • 7