Martijn
Martijn

Reputation: 12102

How are NuGet packages with duplicate ids resolved

As far as I know, NuGet packages are resolved by their Id.

If I have two different, unrelated packages with the same Id on some feed (or on two different feeds), (how) can I differentiate between them?

Upvotes: 1

Views: 449

Answers (1)

Kiliman
Kiliman

Reputation: 20322

NuGet package ids are unique per repository. That is, if you try to upload another package with the same id on nuget.org, it will be rejected since you won't have the correct key.

However, it is possible to create a package on another repository, like MyGet with the same id on NuGet, since these are separate repositories and don't share packages.

Generally, this probably won't happen often since other repositories are typically used for private feeds, so the chance of having duplicate ids will be limited to the one using the private feed.

It's usually a good idea to first check to see if your preferred package id is available on NuGet. If so, you can even submit a dummy package to "reserve" the name before you even start coding. This is similar to domain squatting.

Upvotes: 2

Related Questions