dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

Add `--source` for `dotnet tool install` - for specifying the package source url #37716

Closed 304NotModified closed 1 hour ago

304NotModified commented 8 months ago

dotnet add package and dotnet restore has the --source option:

The URI of the NuGet package source to use during the restore operation.

dotnet tool install is missing that option. It has the --configfile option, but that is more work in the CI/CD (sometimes you don't have a file). Note the --configfile option is also available with dotnet restore but not with dotnet add package

Please add the --source for dotnet tool install

WeihanLi commented 8 months ago

Since we had already --add-source option, would it help? Though they do have different semantic meaning

JL03-Yue commented 8 months ago

@304NotModified

dotnet tool install has a --add-source option that adds an additional NuGet package source to use during installation(referred in this documentation). I wonder if this help with your request? For more information, see What happens when a NuGet package is installed?.

304NotModified commented 8 months ago

Thanks!

Im afraid it won't solve my issue. There are multiple feeds configured already and some need authentication. But unfortunately that wont work on our CI. Also the build machines are reused after the build so I cant do persistent code changes.

So I need a way to only use the non-authenticated feed. For now we do write a config file with powershell (because its a template and we cant force a configfile from our users)

hayer commented 3 months ago

I have tried doing this

dotnet tool install --tool-path . --add-source 'https://api.nuget.org/v3/index.json' --ignore-failed-sources --version 5.3.6 dotnet-reportgenerator-globaltool

But it still fails since the Nuget.config has a private feed.. even though ignore-faileds-sources is set. Seems to be related to https://github.com/dotnet/sdk/issues/24140 ?