Skip to content

Include restore options in documentation for command with implicit restore #3388

Closed

Description

@livarcocc

From @evil-shrike on October 12, 2017 22:5

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)

Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512

Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Copied from original issue: dotnet/cli#7825

Activity

  1. livarcocc commented on Oct 12, 2017

    @livarcocc
    Author

    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.

  2. livarcocc commented on Oct 12, 2017

    @livarcocc
    Author

    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.

  3. livarcocc commented on Oct 12, 2017

    @livarcocc
    Author

    From @evil-shrike on October 12, 2017 22:17

    --source works fine, thanks

    btw the option isn't mentioned in docs - https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore2x for publish and build command (only for restore) but works.

  4. 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
  5. mairaw commented on Oct 12, 2017

    @mairaw
    Contributor

    @livarcocc I don't see --source when I do --help for publish or build either 😄
    I'll add to the docs.

  6. livarcocc commented on Oct 12, 2017

    @livarcocc
    Author

    Yes, I believe we have a bug tracking that somewhere. I will reply back once I find it.

  7. mairaw commented on Oct 13, 2017

    @mairaw
    Contributor

    and why the different behavior from restore which accepts both -s or --source @livarcocc?

  8. livarcocc commented on Oct 13, 2017

    @livarcocc
    Author

    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.

  9. mairaw commented on Oct 13, 2017

    @mairaw
    Contributor

    Thanks @livarcocc. The PR is ready for review.

  10. 2 remaining items

  11. self-assigned this
    on Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions