Skip to content

dotnet list package should support "--platform" and "--configuration" or pass arguments onto MSBuild #14287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
siegfriedpammer opened this issue May 6, 2025 · 1 comment

Comments

@siegfriedpammer
Copy link

siegfriedpammer commented May 6, 2025

NuGet Product(s) Involved

dotnet.exe

The Elevator Pitch

when trying to run:

dotnet list path\to\solution\file.sln package --vulnerable

I receive the error

No assets file was found for <project-file>. Please run restore before running this command.

then running
dotnet restore path\to\solution\file.sln

fails with

error MSB4126: The specified solution configuration "Debug|x64" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (
e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

Unfortunately, neither dotnet restore nor dotnet list package support --platform or --configuration or forwarding of /p:MSBuildVariable=Value arguments.

The functionality of dotnet restore can be easily replicated by calling msbuild /t:Restore /p:... however, afaik, there is no such workaround for the dotnet list package --vulnerable feature...

Additional Context and Details

The solution/projects in question use alternate platform names such as MyPlatformName instead of x64.

@kartheekp-ms
Copy link
Contributor

kartheekp-ms commented May 9, 2025

@siegfriedpammer did dotnet list package command work as expected after executing msbuild /t:Restore /p:... command?

AFAIK, it is by design that dotnet list package requires a successful restore operation to work as expected and it doesn't run restore implicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants