Search code examples
teamcitynuget-packagenuget-servernuspecnuget-spec

Overwriting NuGet Package does NOT change the .NET Version


I had a NET45 project published to NuGet. For internal reasons (this is not a production application), I REQUIRE it to be Version 1.0.1 always no matter what. I am using my own private NuGet Server that is currently fully up to date, and TeamCity as my Build Server.

-See TeamCity edit/addition at the bottom-

So after 4 years, I had to make a slight update to this NuGet Package. I did so and Re-Published it as 1.0.1. I do indeed have allowOverrideExistingPackageOnPush set to true, and I am fairly confident the code was overwritten.

Apart from the one tiny code change, I also changed the project to .NET 4.7.2, as well as updating the nuspec From This, To This...

<!-- From this -->
<file src="bin\Release\....dll" target="lib\net45\....dll" />
<!-- To this -->
<file src="bin\Release\....dll" target="lib\net472\....dll" />

When I check on my Server, my nupkg looks like this:

NuPkg GobblyGook with happy artifacts

Previously it said net45, but now it says net472. Success?

However, my consuming application (Also not a production app), it its Packages/ folder, Only Includes a ...1.0.1/lib/net45 folder.

I tried every way I could think to wipe, restart, clear-cache, and otherwise obliterate that 1.0.1 package from everything. But still, when I push it, it always ends up with ONLY a net45 folder.

Finally to ease my madness, I allowed my very first ever push of 1.0.2 and, MUCH to my surprise, there was a net472 folder. It was perfect.

So how do I TRULY delete package 1.0.1 and/or alter any lingering records so it isn't stuck as net45?

In TeamCity there is a "Caches" page in the Diagnostics menu. I searched around for the definitions and reasons to Reset some of those caches, but nothing jumped out at me related to this. Also, it says not to touch it unless a TeamCity team member tells you to. Not sure if this is related, but if so, somebody with that expertise would be appreciated.


Solution

  • This was indeed a Caching issue for me. But the cache was a local cache, specifically through Visual Studio, but could also be the NuGet local cache. Though the entire infrastructure was correct, my local machine kept giving me the old version.

    In VS, Tools > NuGet Package Manager > Settings > Clear All NuGet Caches.