Docs: Push multiple package is not supprted

Created on 21 Aug 2018  Â·  28Comments  Â·  Source: dotnet/docs

It appears that NuGet currently not support pushing multiple packages by using a glob pattern. Don't know if this is a bug or intentional. dotnet nuget push *.nupkg should be removed.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - .NET Core Guide doc-bug

Most helpful comment

For people who are still having this issue, I was able to resolve by wrapping in quotes:

dotnet nuget push '*.nupkg' ...

All 28 comments

@KathleenDollard, any thoughts?

@livarcocc @rrelyea Should this work?

@vlesierse what error do you get when this happens? On which operating system? And on which version of dotnet?

Also, globbing is not something that the dotnet does by itself, it is actually supported by the underlying shell.

I will let @rrelyea comment on whether or not multiple nupkg publishing is supported or not, independent of globbing.

@livarcocc It's not an error. It just pushes the first package it finds. All examples only includes one package, so it looks like it's working.

@vlesierse that doesn't seem right, the doco right here above states:

"Pushes all .nupkg files in the current directory to the default push source:
dotnet nuget push *.nupkg", so it should work.

@jjpepper Except it doesn't.

~sh
ls *.nupkg
XaasKit.AspNetCore.MultiTenancy.1.0.0-preview1-t000.nupkg
XaasKit.AspNetCore.MultiTenancy.Abstractions.1.0.0-preview1-t000.nupkg
~

~sh
dotnet nuget push *.nupkg -k -s https://www.myget.org/F/xaaskit/api/v2/package
info : Pushing XaasKit.AspNetCore.MultiTenancy.1.0.0-preview1-t000.nupkg to 'https://www.myget.org/F/xaaskit/api/v2/package'...
info : PUT https://www.myget.org/F/xaaskit/api/v2/package/
info : Created https://www.myget.org/F/xaaskit/api/v2/package/ 636ms
info : Your package was pushed.
~

Is it safe to say it it's a bug?

Yes, so they need to fix it or fix the doco.

On Tue, 28 Aug 2018 at 5:44 pm, Vincent Lesierse notifications@github.com
wrote:

@jjpepper https://github.com/jjpepper Except it doesn't.

ls *.nupkg
XaasKit.AspNetCore.MultiTenancy.1.0.0-preview1-t000.nupkg
XaasKit.AspNetCore.MultiTenancy.Abstractions.1.0.0-preview1-t000.nupkg

dotnet nuget push *.nupkg -k -s https://www.myget.org/F/xaaskit/api/v2/package
info : Pushing XaasKit.AspNetCore.MultiTenancy.1.0.0-preview1-t000.nupkg to 'https://www.myget.org/F/xaaskit/api/v2/package'...
info : PUT https://www.myget.org/F/xaaskit/api/v2/package/
info : Created https://www.myget.org/F/xaaskit/api/v2/package/ 636ms
info : Your package was pushed.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/docs/issues/7146#issuecomment-416519843, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AKDoY6OaMQuVZuiiKpDOotIo9zQBqQpqks5uVRD6gaJpZM4WFQio
.

I see the same issue, we have 8 packages put only one is pushed

image

same issue on linux

Any update on this?
I've just verified that dotnet nuget is unable to push multiple packages at the same time and I can see that the documentation has not been updated yet despite being wrong.

I've just tested it with the dotnet core 2.2 docker image: mcr.microsoft.com/dotnet/core/sdk:2.2

the command
dotnet nuget push */**/*.nupkg -s http://iberodev-repository/repository/mirepo/
info : Your package was pushed.

only pushes the first nupkg it finds.

However the command
dotnet nuget push **/*.nupkg -s http://iberodev-repository/repository/mirepo/
info : Your package was pushed.

pushes all the packages and works as expected. Notice the regular expression

@iberodev,

Your solution worked for me. Thank you.

My environment:
gitlab-runner 11.9.1 / linux/Ubuntu 14.04
dotnet-sdk:2.1.302-v2.6

dotnet nuget push $OUTPUT_DIR/**/*.nupkg ...

Thanks for providing the fix @iberodev. I've opened PR #13174 to update the commands for Preview 6 and included this fix as part of it. @karann-msft please verify.

I just tried this and it (as currently documented) works for me....

C:\Users\karann\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug>dotnet --version
3.0.100-preview5-011568
C:\Users\karann\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug>dotnet nuget push *.nupkg -s https://apidev.nugettest.org/v3/index.json -k ~redacted~
info : Pushing KaranClassLibrary01.1.0.0.nupkg to 'https://dev.nugettest.org/api/v2/package'...
info :   PUT https://dev.nugettest.org/api/v2/package/
info :   Created https://dev.nugettest.org/api/v2/package/ 23394ms
info : Your package was pushed.
info : Pushing KaranClassLibrary02.1.0.0.nupkg to 'https://dev.nugettest.org/api/v2/package'...
info :   PUT https://dev.nugettest.org/api/v2/package/
info :   Created https://dev.nugettest.org/api/v2/package/ 430ms
info : Your package was pushed.
error: File does not exist (*.snupkg).

yes, there is an error at the end but that's a different issue. Both packages did get pushed.
https://dev.nugettest.org/packages/karanclasslibrary01
https://dev.nugettest.org/packages/karanclasslibrary02

@karann-msft,

You're using a preview version of 3.0, most current users have build environments using SDK buildpacks of either 2.1 or 2.2. For many, like myself, 3.0 preview isn't even an option yet.

@WhiteEagle5150 same result with dotnet 2.2.300

C:\Users\karann\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug>dotnet --version
2.2.300
C:\Users\karann\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug>dotnet nuget push *.nupkg -s https://apidev.nugettest.org/v3/index.json -k ~~redacted~~
info : Pushing KaranClassLibrary01.1.0.1.nupkg to 'https://dev.nugettest.org/api/v2/package'...
info :   PUT https://dev.nugettest.org/api/v2/package/
info :   Created https://dev.nugettest.org/api/v2/package/ 1087ms
info : Your package was pushed.
info : Pushing KaranClassLibrary02.1.0.1.nupkg to 'https://dev.nugettest.org/api/v2/package'...
info :   PUT https://dev.nugettest.org/api/v2/package/
info :   Created https://dev.nugettest.org/api/v2/package/ 362ms
info : Your package was pushed.
error: File does not exist (*.snupkg).

@karann-msft

Are you using Windows or Linux? I have to perform my builds from an Ubuntu container, using dotnet-sdk:2.1.302 build pack.

@WhiteEagle5150 do you mind trying 2.2.300 on whatever environment you are on.

@karann-msft,

Unfortunately, that isn't an option for me. Our GitLabs policies are pretty strict right now, but i anticipate they will loosen up a little over time. That 2.1 Sdk is all I can use right now. Part of this has to do with our hosting environment, right now, it is only supporting the 2.1 build packs for our docker containers.

@mairaw this seems to be a bug in older versions of the sdk. newer versions work fine.

Thanks for checking @karann-msft. So, perhaps we should add a note about the bug in older versions of the SDK in the doc?

I seem to get this issue with latest range of dotnet tools when running my new Github Actions CI running on 'ubuntu-latest'. EDIT: The workaround for older SDK's of using */.nupkg seems to work fine.

From the workflow output:

Run dotnet --version
3.1.101

Run ls
...
Innofactor.EfCoreJsonValueConverter.2.0.1-beta0011.nupkg
Innofactor.EfCoreJsonValueConverter.Attributes.2.0.1-beta0011.nupkg
...

Run dotnet nuget push *.nupkg --api-key *** --source https://apiint.nugettest.org/v3/index.json --no-symbols true
info : Pushing Innofactor.EfCoreJsonValueConverter.2.0.1-beta0011.nupkg to 'https://int.nugettest.org/api/v2/package'...
info :   PUT https://int.nugettest.org/api/v2/package/
warn : The <licenseUrl> element is deprecated. Consider using the <license> element instead. Learn more: https://aka.ms/deprecateLicenseUrl.,The <iconUrl> element is deprecated. Consider using the <icon> element instead. https://aka.ms/deprecateIconUrl
info :   Created https://int.nugettest.org/api/v2/package/ 401ms
info : Your package was pushed.

For people who are still having this issue, I was able to resolve by wrapping in quotes:

dotnet nuget push '*.nupkg' ...

FYI @donnie-msft @aortiz-msft

Tried on Linux for multiple versions of dotnet:
2.1.302

henli@henli001UbuntuRepro:~/packages$ dotnet --version
2.1.302
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ *.nupkg
info : Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ '*.nupkg'
info : Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.
info : Pushing project2.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.

2.2.300

henli@henli001UbuntuRepro:~/packages$ dotnet --version
2.2.300
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ *.nupkg
info : Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ '*.nupkg'
info : Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.
info : Pushing project2.1.0.0.nupkg to '/home/henli/source/'...
info : Your package was pushed.

3.1.201

henli@henli001UbuntuRepro:~$ dotnet --version
3.1.201
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ *.nupkg
Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
Your package was pushed.
henli@henli001UbuntuRepro:~/packages$ dotnet nuget push --source ~/source/ '*.nupkg'
Pushing project1.1.0.0.nupkg to '/home/henli/source/'...
Your package was pushed.
Pushing project2.1.0.0.nupkg to '/home/henli/source/'...
Your package was pushed.

Without quotes, only the first package is pushed.
With quotes, all packages are pushed.

For clarity, Windows still works as expected in dotnet 3.1.300-preview-015048.

Both push all expected packages (not just 1):
dotnet nuget push *\**\*.nupkg --source "nugettest" --skip-duplicate
dotnet nuget push *\*\*\*.nupkg --source "nugettest" --skip-duplicate

Heng's comment shows it best. When using '*.nupkg', it tells the shell not to expand the wildcard, so the * character is really passed to NuGet (via dotnet), and NuGet does its own globbing. Windows cmd.exe doesn't support globbing (not sure about powershell, my guess is no), which is why the single quotes are not needed around the *.nupkg. On Linux, every shell I've ever used supports globbing, so that individual apps don't need to.

Fundamentally, the issue is that dotnet nuget push package1.nupkg package2.nupkg doesn't work. That's what dotnet/NuGet sees on Linux (or other shells), where the shell supports globbing and expands it before passing the arguments to the process.

I think it's not Windows vs Linux, it's all about whether the shell expands globs, and NuGet appears to only support only a single argument.

Since the issue still exists, please reopen this issue. Thanks! @mairaw

After discussion, we would like to keep it closed. Sorry for the confusion caused!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sdmaclea picture sdmaclea  Â·  3Comments

stjepan picture stjepan  Â·  3Comments

LJ9999 picture LJ9999  Â·  3Comments

ygoe picture ygoe  Â·  3Comments

Manoj-Prabhakaran picture Manoj-Prabhakaran  Â·  3Comments