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

sln-add: Get project DefaultProjectTypeGuid #47661

Open
wants to merge 6 commits into
base: release/9.0.2xx
Choose a base branch
from

Conversation

edvilme
Copy link
Member

@edvilme edvilme commented Mar 17, 2025

Fixes #47638

Description and impact

When adding a new project that is not known for the SDK or MSBuild, it should read the DefaultProjectTypeGuid property from the project file.

Regression

Yes - this worked before 9.0.2xx

Risk

Low – Currently it errors when adding unknown project types, unless the ProjectTypeGuid is specified on the project itself, or on the solution file.

Testing

Unit tests on this were ambiguous, so they were renamed to better match their cases.
I was also able to reproduce the bug...

Existing behavior
image

Expected behavior
image

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

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the handling of retrieving the project type GUID when adding a project to a solution by using the default project type GUID if the primary method returns null.

  • Moved the instantiation of ProjectInstance before the try-catch block.
  • Updated GUID retrieval to fallback to the default project type GUID.
  • Removed duplicate instantiation of ProjectInstance.
@edvilme
Copy link
Member Author

edvilme commented Mar 17, 2025

Update: This appears to collide with WhenPassedAnUnknownProjectTypeItFails and WhenPassedAProjectWithoutATypeGuidItErrors, do we have specific differences for these cases?

Further update: One of these is skipped, while the other one must only matter when it can't find either the project type guid or the default project type guid

@edvilme
Copy link
Member Author

edvilme commented Mar 17, 2025

Also addresses #522

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

Successfully merging this pull request may close these issues.

3 participants