1

I'm using a nuget in my project which is supposed to have a namespace called ChartJs.Blazor.ChartJS.Common.Time in the version 0.10.4. For some reason, it tells me the namespace doesn't exist. I'm 100% certain that it does, here's why:

  • I published that nuget myself and tested it.
  • When downloading the nuget from nuget.org and inspecting the nupkg-file by opening it with 7-zip, I can find the dll used for the nuget in the folder lib. If I copy that dll outside the nupkg and reference it directly (instead of the nuget), it all works perfectly fine and the code compiles.
  • I also looked at the dll (extracted mentioned above) with ILSpy and could confirm that the namespace and its files do in fact exist.

There is absolutely no sign of the absence of these files anywhere.

Since I did some manual testing with the same package version but the package contents were actually different, I suspect caching issues. However, I already tried a few things which helped me previously with a similar issue but none of them worked this time:

  • Delete the corresponding folder in %userprofile%\.nuget\packages
  • Delete all bin and obj (and .vs) folders.
  • Delete all temporary files (using the built-in windows tool)

FYI, there's nothing of interest at %appdata%/NuGet.

Does anyone know what the issue could be and how it can be resolved? The current workaround is to directly include the dll but that isn't great.

Ps. The installed NuGet version is 5.1.0.6013 but I'm usually just working with Visual Studio 2019 where nuget is integrated.

EDIT:
The library which is consumed via nuget is targetting netstandard2.0 (standard library). The consuming project is targetting netcoreapp3.0 (asp.net core ss-blazor). This alone should not be an issue.

Joelius
  • 3,839
  • 1
  • 16
  • 36
  • Is this your library? It might because there is a dependency on Microsoft.AspNetCore.Components.Web which may need to use a FrameworkReference instead of a Package reference. Checkout https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#migrate-libraries-via-multi-targeting for multi-targeting – awright18 Oct 16 '19 at 18:49
  • Yes it's my library. It was a caching issue (as suspected). I have added an answer to clear it up but cannot accept it yet :/ – Joelius Oct 16 '19 at 19:23

1 Answers1

1

It was indeed a caching issue - it's just sad how much time can go to waste for something this simple. Even though I thought I cleared all cache, I missed a few folders (why does nuget use so many of those?). The solution was to clear all the cache using nuget locals all -clear, which is also described in this answer.

Clear your cache, kids.

Joelius
  • 3,839
  • 1
  • 16
  • 36