Add --configfile switch to dotnet list package
See original GitHub issueIs your feature request related to a problem? Please describe.
I am cloning repositories in an Azure DevOps pipeline from multiple organisations to search for package issues (deprecated, outdated and vulnerable dependencies). I determine the possible Azure Artifact feeds that may be involved in running dotnet
CLI commands against that repository and dynamically generate a nuget.config file.
Running dotnet restore '{csprojpath}' --configfile '{temppath}/nuget.config' --ignore-failed-sources
works completely fine. Part of the log output of the restore includes this:
NuGet Config files used:
/agent/_work/_temp/feedconfig/{someorg}/{someproject}/nuget.config
Feeds used:
https://api.nuget.org/v3/index.json
https://pkgs.dev.azure.com/{someorg}/{someprojectid}/_packaging/{projectfeedid}/nuget/v3/index.json
https://pkgs.dev.azure.com/{someorg}/_packaging/{orgfeedid}/nuget/v3/index.json
The dotnet list {csprojpath} package
CLI commands do not support a --configfile
switch and I cannot get it to consult those feeds. For example, I run dotnet list {csprojpath} --outdated
and I get the following in the output:
The following sources were used:
https://api.nuget.org/v3/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.extensions.http/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.extensions.storage/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.sdk/index.json
GET https://api.nuget.org/v3/registration5-gz-semver2/{myinternalpackage}/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/system.text.regularexpressions/index.json
NotFound https://api.nuget.org/v3/registration5-gz-semver2/{myinternalpackage}/index.json 401ms
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.extensions.http/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.extensions.storage/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.azure.functions.worker.sdk/index.json
GET https://api.nuget.org/v3/registration5-gz-semver2/{myinternalpackage}/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/system.text.regularexpressions/index.json
NotFound https://api.nuget.org/v3/registration5-gz-semver2/{myinternalpackage}/index.json 280ms
Project `{MyProject}` has the following updates to its packages
[net6.0]:
Top-level Package Requested Resolved Latest
> {MyInternalPackage} 1.0.0 1.0.0 Not found at the sources
Describe the solution you’d like
dotnet list
supports the --configfile
switch so that we can be explicit on the CLI regarding which feeds to consume for that operation.
Additional context
I have tried running the dotnet CLI commands with the working directory that contains nuget.config. I have also tried installing the artifacts credential provider and building the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS
environment variable. Nothing I have done will get dotnet list package
to check the feeds in my custom nuget.config.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
The
-config
switch works as expected. My scanning is now consulting our internal AzDO feeds.I agree on the documentation, but one thing I want to work towards is having a consistent set of options for the same concepts across operations. Every operation that takes MSBuild parameters needs to support
-p
, every operation that is backed by NuGet needs to support a config file by some shared name.--config
and--configfile
being separate in these two commands is just annoying enough to make me want to unify it, that’s all I mean.