You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include restore options in documentation for command with implicit restore #3388
I run dotnet publish to create a msdeploy package. I supplying an -s option with my NuGet private server. But I made a mistake in the repository url and got 404 error. It expected. But it means that nuget tried to restore my package from my nuget server.
C:\Work>dotnet publish -c Debug -s "https://company/api/nuget/rnd-virtual-internal" /p:WebPublishMethod=Package /p:DeployIisAppPath=mysite /p:PublishProfile=profile
C:\Program Files\dotnet\sdk\2.0.2\NuGet.targets(102,5): error : Failed to retrieve information about 'MyPackage' from remote source 'https://company/api/nuget/rnd-virtual-internal/FindPackagesById()?id='MyPackage''.\r [C:\Work\Server.csproj]
C:\Program Files\dotnet\sdk\2.0.2\NuGet.targets(102,5): error : Response status code does not indicate success: 404 (Not Found). [C:\Work\Server.csproj]
Then I fixed error in the url and repeated:
C:\Work>dotnet publish -c Debug -s "https://company/api/nuget/nuget-virtual-internal" /p:WebPublishMethod=Package /p:DeployIisAppPath=mysite /p:PublishProfile=profile
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1001: Unknown switch.
Switch: -s
but what I got is MSBUILD error for my -s option.
I would understand if dotnet publish doesn't support --source option at all but if so why 404 happened with incorrect url?
Previously on netfx I used /p:PackageSources="source" property but now on dotnet publish it's ignored.
Environment data
dotnet --info output:
D:\Work>dotnet --info
.NET Command Line Tools (2.0.2)
can you try with --source instead of -s. We don't support short hand parameters being passed to restore through other commands, because we ran into conflicts in the shorthands.
Though I get your point on how it was used during the first restore.
I tried that command and I always get the -s is an invalid switch. I wonder if that source was available to NuGet through some other means or some caching that NuGet might have done from some previous command that you attempted.
cc @emgarten is case he has some insight. I don't believe that we are passing the URL using -s when the URL is invalid. We only respect --source in that case.
changed the title [-]dotnet publish incorrectly handles --source option (nuget source for restoring)[/-][+]Include restore options in documentation for command with implicit restore[/+]on Oct 12, 2017
Because there are conflicts in the short form. Some commands that support implicit restore already had a -s (or some other short form parameter) taken that conflicted with the ones in restore. So, for implicit restore parameters we had to instead choose to only accept full form parameters.
Activity
livarcocc commentedon Oct 12, 2017
can you try with --source instead of -s. We don't support short hand parameters being passed to restore through other commands, because we ran into conflicts in the shorthands.
Though I get your point on how it was used during the first restore.
livarcocc commentedon Oct 12, 2017
I tried that command and I always get the -s is an invalid switch. I wonder if that source was available to NuGet through some other means or some caching that NuGet might have done from some previous command that you attempted.
cc @emgarten is case he has some insight. I don't believe that we are passing the URL using -s when the URL is invalid. We only respect --source in that case.
livarcocc commentedon Oct 12, 2017
From @evil-shrike on October 12, 2017 22:17
--sourceworks fine, thanksbtw the option isn't mentioned in docs - https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore2x for
publishandbuildcommand (only forrestore) but works.[-]dotnet publish incorrectly handles --source option (nuget source for restoring)[/-][+]Include restore options in documentation for command with implicit restore[/+]mairaw commentedon Oct 12, 2017
@livarcocc I don't see --source when I do --help for
publishorbuildeither 😄I'll add to the docs.
livarcocc commentedon Oct 12, 2017
Yes, I believe we have a bug tracking that somewhere. I will reply back once I find it.
mairaw commentedon Oct 13, 2017
and why the different behavior from restore which accepts both -s or --source @livarcocc?
livarcocc commentedon Oct 13, 2017
Because there are conflicts in the short form. Some commands that support implicit restore already had a -s (or some other short form parameter) taken that conflicted with the ones in restore. So, for implicit restore parameters we had to instead choose to only accept full form parameters.
mairaw commentedon Oct 13, 2017
Thanks @livarcocc. The PR is ready for review.
2 remaining items