-
Notifications
You must be signed in to change notification settings - Fork 255
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
dotnet list package returns error if solution includes a docker-compose project #12520
Comments
We use it to track The workaround for our pipeline is to only perform a You can also edit your solution file and move the docker project as the last project. That way it only fails at the end. Which in our cases isn't a problem. When you indicate the |
Just to chime in that the issue is more general and applies to other "unexpected" project types. For example, it fails if sln contains *.sqlproj projects. The same dumb workaround helps - remove from solution, run command, git revert. But this is PITA if you want to automate things. The |
…xed: dotnet list package returns error if solution includes a docker-compose project
I wish there was a way to tell dotnet list to ignore projects that it errors from not being able to work with them instead of returning an error. Its a very useful command to get extra troubeshooting info in a build but don't want to break the build cause a solution contains a project that isn't compatible while others are. |
Any news / solution on this? This issue is 1 year old :( |
My workaround is to generate a solution with only the .csproj projects from the base solution, and then use the generated solution with dotnet new sln <sln-base-name>.g
$projects = dotnet sln <sln-base-name>.sln list | Where-Objects {$_.EndsWith('csproj')}
dotnet sln <sln-base-name>.g.sln add $projects
dotnet list <sln-base-name>.g.sln package --vulnerable --include-transitive This is cumbersome when running locally, but its pretty straight forward to run in a CI pipeline. If your like me and your main concern is vulnerability checks and you have updated to .NET 8, there is also the option to enable vulnerability checking during package restore at the .csproj level. This avoids the problem and is a more flexible feature overall. |
NuGet Product(s) Affected
dotnet.exe
Current Behavior
This is likely related to the behavior change described here: #12479
My organization has a pipeline step that lists vulnerable packages for our ASP.NET Core soutions using:
dotnet list <soution>.sln package --vulnerable --include-transitive
After updating our toolchain from dotnet 6 to dotnet 7, this command now returns a non-zero error code for all of our projects even if no vulnerable packages are found. We get an error message:
The project <path>\docker-compose.dcproj
uses package.config for NuGet packages, while the command works only with package reference projects.`Which seems to be the source of the error.
Desired Behavior
Ideally, there would be some way to tell the tool to ignore the docker-compose.csproj file since it is irrelevant to this scan.
Failing that, treating the incompatible file as a warning and not an error would allow us to detect actual issues with the tool.
Additional Context
I tested using dotnet.exe version 7.0.201
It's very easy to reproduce this without any custom code.
dotnet list <soution>.sln package
. No need to even check for vulnerabilities.$LASTEXITCODE
and see that it is1
.We have been forced to disable this check due to this behavior. I found an old issue: microsoft/MSBuildSdks#131
Which suggests a possible workaround of defining the
RestoreProjectStyle
setting in the problem project. But the workaround is not valid for the docker-compose project, which does not have NuGet dependencies.The text was updated successfully, but these errors were encountered: