Search code examples
c#nugetazure-artifactspackagereference

Package reference in C# has the wrong using statements


I have a C# project in VS Code running on .NET 6.0. I have a package reference which is the correct version, but the using statements in it are from an older version which causes errors, and I have no idea how to fix it.

If I reference it from a project reference, it works.

When I click F12 to view the file, I can see the differences, but also see the package is the right one (earlier it was referencing an older version which caused the same problem).

I have run dotnet clean, dotnet restore and dotnet build but the issue persists.

Any suggestions would be appreciated.


Solution

  • I ended up clearing the nuget cache using cli as visual studio code as no internal mechanism.

    n the dotnet CLI, use dotnet nuget locals all --clear. In the NuGet CLI, use nuget locals all -clear.