Search code examples
c#.netnugetnuget-packageapi-key

Not able to upload a Nuget Package


So for the first time, I am creating nuget package for a .Net Framework Library and I want to upload it to the nuget server. I have followed this tutorial Nuget Package Creation and I have got my account created in Nuget and also I have created the API key and even the nuget package is ready in the solution folder. But when I run below command to push the package I get the API Key error.

enter image description here

Error: THe specifies API key is invalid or does not have the permission. But I just now created and account and the API key. Please guide me.

When I try to upload directly to Nuget Website I get below error:

enter image description here


Solution

  • The following message might be displayed when a user tries to upload a package with the same id of another package (more info on Unable to upload package):

    The package ID 'xxxxxxx' is not available

    So, instead of using a generic default namespace and assembly name:

    Project properties with default namespace

    Consider using your own namespace, in order to avoid package ID conflicts. Package will be generated with the same name as the assembly name. Example:

    Project properties with custom namespace

    Changing the package ID in .NET Standard Class Libraries

    If you're using a .NET Standard Class Library you can change the package ID directly in the project properties > Package section:

    Project properties - Package section

    Please note that by default the package ID is the same as the Assembly Name.