How do I publish a NuGet package for a legacy assembly? #54575
Replies: 3 comments 1 reply
-
To publish a NuGet package to a GitHub Package Registry using nuget.exe, you need to open the directory containing the .nupkg file and run Make sure your token has write:packages, read:packages, and repo permissions, and configure the registry to be a NuGet source using a nuget.config file that includes your GitHub credentials. |
Beta Was this translation helpful? Give feedback.
-
PROJECT_NAME is your NuGet package name, usually the same as your project name. Running nuget.exe push won't overwrite your repo, it just uploads your package to the NuGet feed. YOUR_GITHUB_PAT is the Personal Access Token itself, not its name. You use it to authenticate when you're pushing the package to GitHub. You're right, you don't want to commit your PAT to your repo. Instead, put it in an environment variable and reference that in your NuGet.Config file. e.g. < packageSourceCredentials> %GITHUB_PAT% being an environment variable in this example holding your PAT. NuGet will replace %GITHUB_PAT% with the value of the GITHUB_PAT environment variable. To set the GITHUB_PAT environment variable on your machine to your actual PAT, you can use this command on Windows: |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I'm trying to publish my first NuGet package to a GitHub Package in our GH organization. The DLL is written using .NET Framework 4.5.2, so as far as I know that means I cannot use a command line argument like
dotnet nuget
. Instead I've downloaded the NuGet.exe, then placed that in a folder that's in my PATH environmental variable. That works fine and I've created a .nuspec file, then made the necessary modifications to it, then I generated the .nupkg file. Previously I created a classic personal access token. I've been following the Working with the NuGet registry tutorial, but when I get to Publishing a package at Step 3, it has this example:I believe I'm back to the problem of having an example that uses
dotnet nuget
, whereas I cannot use that, but must use the legacy style due to the assembly being written using .NET Framework 4.5.2. Now, if I'm wrong; if I can use thedotnet nuget
command instead, please let me know! Otherwise, if I'm correct that I cannot usedotnet nuget
here, how do I proceed to publish to a GH Puackage in our GH organization?Beta Was this translation helpful? Give feedback.
All reactions