Multiple -s/--source flags on "dotnet build" and "dotnet restore" not working
See original GitHub issueThe “dotnet restore” page: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore says
-
-s|--source <SOURCE>
Specifies the URI of the NuGet package source to use during the restore operation. This setting overrides all of the sources specified in the nuget.config files. Multiple sources can be provided by specifying this option multiple times.
I believe the same should apply to the -s|–source flag of “dotnet build” (even though its page fails to mention the “Multiple sources can be provided by specifying this option multiple times” part).
But specifying -s|--source
multiple times does not seem to work if you try to list a folder and a URL, on either “dotnet build” or “dotnet restore”.
My problem: We are building a C# SDK that is entering private preview, hence in order to use it you have to download the NuGet file to your local disk and install it (it is not available on any public feed). So I need to tell dotnet/nuget to use a local folder as one of its sources. On the other hand, our sample application also needs other (public) nuget packages (e.g. Azure.Core). So I need to tell dotnet/nuget to use both a local folder feed and the public nuget.org feed.
I know I can do always add a local nuget source using this separate command to add the local feed (this works fine):
dotnet nuget add source c:\packages --name local
But I don’t want users to run that extra command (and then another command to delete this local source).
I want to give them one “dotnet build” command that will also specify the nuget sources, like this:
dotnet build ImageAnalysisQuickstart.csproj --source c:\users\dcohen\downloads --source https://api.nuget.org/v3/index.json
When I run the above I get the following error:
error NU1301: The local source ‘d:\git\cognitive-services-vision-sdk-private-preview\https:\api.nuget.org\v3\index.json’ doesn’t exist.
Looks like it’s treating the nuget.org URL as a folder path and adding it to the path where I’m running the command.
Does anyone know the right way to specify multiple nuget sources on the “dotnet build” command?
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:10 (3 by maintainers)
Top GitHub Comments
had same exact issue only happen on windows, it works fine on linux and macos
Thank you all for your comments!