I'm working with .Net Core and am trying to create a Nuget Library.
I'm packaging my project with this command:
dotnet pack MyRepo/MyProject/MyProject.csproj -c Release
It always creates the file MyProject.1.0.0.nupkg
inside the bin/Release
folder.
When I try to push this package using this command:
dotnet nuget push MyRepo/MyProject/bin/Release/MyProject.1.0.0.nupkg --api-key ${GET_KEY_FROM_REPO} --source "mygithub"
I get the following error:
warn : Error: Version 1.0.0 of "MyProject" has already been pushed.Conflict https://nuget.pkg.github.com/myrepo/ 307msTo skip already published packages, use the option --skip-duplicateerror: Response status code does not indicate success: 409 (Conflict).
How can I avoid that? Should I go and manually rename the package each time? (it seems like a completely terrible idea to me).
Why doesn't it version the package automatically so I would be able to push a newer version?
Can I set it up somehow in VS2022 so it would add version to the name automatically on build in Project Settings?
Thanks!