Nandun
Nandun

Reputation: 2042

Nuget package does not contain latest code unless version number is modified in project properties

This is a NuGet newbie question.

I have a .net core 2.0 class library project which I have just started working on. I need to package this and install that package in a different asp.net project which is also in its initial stages.

So right now there are frequent, major changes occurring in both projects.

Right now, every time I modify something in the class library project, I package it to a .nupkg file and install it to my asp.net project so that my changes are available in the asp.net project.

However my issue is that when I package the library I have to keep incrementing the Package Version in the project properties, and update the package to the latest version in the asp.net project.

Its almost as if every version is cached. I have tried cleaning the solution but still no luck.

I don't want to keep changing the version at this stage because I'm just starting off and have not set up CI/CD pipelines.

How can I clear off all traces of a nuget package so I can create and install a new package with updated code without having to change the version?

Upvotes: 3

Views: 2160

Answers (1)

RB.
RB.

Reputation: 37222

You can do this.

If it's an old-style csproj (i.e. if you are using a "packages.config" file) then you can simply delete the %SOLUTION_ROOT%\packages folder (or the specific packages within it). The packages will get redownloaded on the next build.

If it's a new-style csproj (i.e. you have <PackageReference> elements in your project file) then the packages are stored globally in %USERPROFILE%\.nuget\packages\. Delete the contents of this folder (or the specific packages within it) and the package will be redownloaded on the next build.

EDIT

Just noticed that you are using a .NET Core project - in which case you are almost certainly using the new-style csproj format, so go with my 2nd suggestion :)

Upvotes: 6

Related Questions