Skip to content
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 sln remove smart project matching #47112

Merged
merged 3 commits into from
Feb 27, 2025
Merged

Conversation

edvilme
Copy link
Member

@edvilme edvilme commented Feb 26, 2025

Fixes #47111

dotnet solution remove baz

This would find a .csproj file named baz.csproj in the solution, independent of the path to the project. If there is a conflict (aka, multiple baz.csproj files), it would error. Otherwise, it would do the smart thing, find the project defined as foo/bar/baz/baz.csproj and remove it.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Feb 26, 2025
@edvilme edvilme marked this pull request as ready for review February 26, 2025 17:26
@Copilot Copilot bot review requested due to automatic review settings February 26, 2025 17:26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/Cli/dotnet/commands/dotnet-sln/remove/Program.cs:80

  • The empty catch block may suppress unexpected exceptions that could help diagnose issues. Consider catching a specific exception or logging the caught exception to aid in troubleshooting.
if (project is null && !Path.HasExtension(projectPath)) { try { ... } catch { project = null; } }
@edvilme edvilme requested review from MiYanni and a team February 26, 2025 17:27
@edvilme edvilme changed the title (Draft) sln remove smart project detection sln remove smart project matching Feb 26, 2025
@edvilme edvilme changed the title sln remove smart project matching dotnet sln remove smart project matching Feb 26, 2025
@richlander
Copy link
Member

This seems like a good idea. I haven't run into this but I can see how annoying the current behavior would be.

@edvilme
Copy link
Member Author

edvilme commented Feb 26, 2025

Couple design remarks

  • The current behavior when the command doesn't find a project is to print an error message, without failing. To keep consistency, I think that should still be the case here
  • The issue mentioned .csproj, but I think it would align more with user expectations if it detected any project extensions

@edvilme edvilme force-pushed the edvilme-sln-remove-smart branch 2 times, most recently from ce6f475 to ca42c84 Compare February 27, 2025 00:07
@edvilme edvilme force-pushed the edvilme-sln-remove-smart branch from ca42c84 to 4615216 Compare February 27, 2025 17:31
@edvilme edvilme requested review from a team, tmat and AntonLapounov as code owners February 27, 2025 17:31
@edvilme edvilme requested review from a team and vijayrkn as code owners February 27, 2025 17:31
@edvilme edvilme changed the base branch from release/9.0.3xx to main February 27, 2025 17:32
@333fred 333fred removed request for a team and tmat February 27, 2025 17:38
@edvilme
Copy link
Member Author

edvilme commented Feb 27, 2025

Re-targeted to main to be released on .net 10 instead

@edvilme edvilme enabled auto-merge (squash) February 27, 2025 19:16
@edvilme edvilme merged commit c2e76e4 into main Feb 27, 2025
37 of 39 checks passed
@edvilme edvilme deleted the edvilme-sln-remove-smart branch February 27, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet solution remove - smart project detection
3 participants