Reputation: 642
I have my own NuGet feed in Azure Artefacts. Currently, there are two packages in the feed:
The top one is a .NET Core library and the bottom one is a .NET Framework library.
I need to push an update to the NuGet feed for both versions to be 1.0.1 - but I'm having some trouble doing this. I packed 'INTLConfiguration.Client' and renamed the .nukpg from INTLConfiguration.Client.1.0.0.nupkg
to INTLConfiguration.Client.1.0.1.nupkg
and tried to push the nuget to my source feed but it errored with a conflict message saying v1.0.0
already exists.
How do I go about updating both of these nuget packages into my source feed?
Thank you.
Upvotes: 0
Views: 2677
Reputation: 28196
I packed 'INTLConfiguration.Client' and renamed the .nukpg from INTLConfiguration.Client.1.0.0.nupkg to INTLConfiguration.Client.1.0.1.nupkg
It seems that your update is just to rename the output xxx.nupkg
. It's not the valid way to create updated .nupkg. A xx.nupkg
is something like a .zip
. Renaming it from Name.nupkg
to Name.zip
and then you can unzip it and see its content. Open the ProjectName.nuspec and you can find the version defined in it is still 1.0.0
.
My guess:
Maybe the way you use to pack is something like creating a .net core project and right-click the pack button which outputs a ProjectName.1.0.0.nupkg.
1# If so, the easiest way to resolve it is right-click Project name in Solution Explorer=>Properties and change the Package version there:
Change the version to 1.0.1 and pack it again.
2# Also we can use .nuspec file defined by us for this option.
xxx.nuspec
. Change its build action
in property window
to content
.xxx.csproj
file. Add a script like below into it:
<PropertyGroup>
<NuspecFile>NuspecName.nuspec</NuspecFile>
</PropertyGroup>
Then reload the project
, every time when we use Pack option it will call NuspecName.nuspec
file.
To create a nuget package by
command-line
, I suggest you use dotnet.exe or nuget.exe.
For your .net core project, you can use dotnet pack command
.Some details about it see here.
3# To create a .net core
package with version 1.0.2
without using a .nuspec file:
Open cmd.exe, and type command: cd C:\PathToProjectFolder
to navigate to ProjectDir(where exists xx.csproj)
Then type command like dotnet pack -p:PackageVersion=1.0.1
to create a really version-1.0.1 nuget package. (If you only have one .csproj in the dir)
Or you need to specify the .csproj like: dotnet pack ~/projects/app1/project.csproj -p:PackageVersion=1.0.1
4# To create a .net core package with version 1.0.2 using a .nuspec file:
Create a .nuspec file and modify its content to meet your needs(Version, AuthorName...).
Open cmd.exe and use a command like:dotnet pack ~/projects/app1/project.csproj /p:NuspecFile=~/projects/app1/project.nuspec /p:NuspecBasePath=~/projects/app1/nuget
If you use the Pack option(Right-click project=>Pack button) in VS, check 1# or 2#.
If you use command-line, you can check 3# or 4#. Hope it helps:)
Update:
How do I go about updating both of these nuget packages into my source feed?
You can check this tutorial to create a package which targets .net framework.And update the version in .nuspec before you pack it. Also, if you want to get an updated nuget package, I suggest you update the assembly version and file version for the dll itself also.
Upvotes: 3