Pawan Nogariya
Pawan Nogariya

Reputation: 8980

Is there a setting in proget nuget server to make it consider version 1.0.1.0 = 1.0.1

Is there any setting in proget nuget server which can make it treat version 1.0.1.0 = 1.0.1

So basically when any of the version's package is tried to restore then it will return 1.0.1.0 version's package.

Because I have a package with version 1.0.1.0 in my project but whenever I try to restore it, it always try to look for 1.0.1, skipping the last zero and so it throws error that the package does not exist. Because proget server has 1.0.1.0 version.

It works when I use my local folder as nuget source in visual studio. Because from local folder it restores the version 1.0.1.0 because it seems for local folder somehow it treats 1.0.1.0 = 1.0.1

Any idea?

Upvotes: 0

Views: 159

Answers (1)

Mr Qian
Mr Qian

Reputation: 23818

Is there a setting in proget nuget server to make it consider version 1.0.1.0 = 1.0.1

ProGet nuget server does not have an option to make it consider version 1.0.1.0 = 1.0.1.

I think the package is packed by on old nuget cli <=v 3.3.0. And since nuget v3.4.4, nuget will remove the fourth node if it is zero automatically.

And the latest VS and nuget will ignore the fourth zero node of the package version if you install your package version 1.0.1.0. See this official Microsoft document.

So if you install it from local source or nuget.org, on these sources, it will remove the last zero from the source path.

However, on ProGet server(third party nuget server and not Microsoft), it still retain the fourth zero node of the package version. So when you install this package on VS, it shows the version 1.0.1.0 in packages.config file and when you restore it, it will find version 1.0.1 since the new rule of nuget.

And actually, when you enable the ProGet package source, it can still find version 1.0.1.0. In my side, although it still shows version 1.0.1.0 and vs have to catches 1.0.1 during restore process, the project will still works well.

So I suspect there is some deviation between you and my environment.

This is my test process:

For an example

This is my package:

enter image description here

In VS, it shows version 1.0.1.

enter image description here

But, on ProGet nuget server, it shows version 1.0.1.0.

enter image description here

Suggestion

First, try to clean nuget caches first or delete all files under C:\Users\xxx\.nuget\packages.

Then enable the proget nuget server package source and remember to check it:

enter image description here

============================================

If you still face the error, you could follow these below:

As a suggestion, you could upload your package on nuget.org, and it will automatically cull your package to version 1.0.1 and then it will synchronize to the ProGet nuget server.

When I upload the version 1.0.1.0 on nuget.org, it shows version 1.0.1:

enter image description here

Upvotes: 0

Related Questions