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: Support for slnx #44570

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

sln-add: Support for slnx #44570

wants to merge 31 commits into from

Conversation

edvilme
Copy link
Member

@edvilme edvilme commented Oct 31, 2024

Contributes to #40913

The dotnet CLI should support the new slnx format for building and in the existing solution management commands. It should also help interested users migrate to the new format.

This adds dotnet sln add support for .slnx files

@edvilme edvilme force-pushed the edvilme-slnx-add branch 2 times, most recently from d397257 to b6aa066 Compare November 5, 2024 20:55
@kasperk81
Copy link
Contributor

@edvilme checkout the complete feedback. using solution.FindProject makes the regex usage irrelevant

@edvilme
Copy link
Member Author

edvilme commented Nov 11, 2024

Turns out the heuristics for generating project GUIDs are different between the old and new serializers, which was causing several tests to break. Replacing them should have no repercussions as they are mostly for identifying the projects individually

@edvilme edvilme marked this pull request as ready for review November 11, 2024 23:43
@kasperk81
Copy link
Contributor

running dotnet sln add foo.weirdproj currently results in:

  • project 'foo.weirdproj' has an unknown project type and cannot be added to the solution file. contact your sdk provider for support. — when the xml is valid
  • invalid project 'foo.weirdproj'. the project file could not be loaded. data at the root level is invalid. line 1, position 1. — when the xml is invalid

the second error reflects validation behavior that goes against the single responsibility principle, as dotnet sln add shouldn’t be responsible for project file validation (unlike dotnet build).

tests conforming to SlnFile behavior (that passing an explicit unknown guid should succeed) have no user-facing meaning because, fortunately, there is no guid argument in the dotnet sln add command. removing these tests and related special error handling would simplify the code.

if tools like vs, vscode, slngen, and the sdk are transitioning to vs-solutionpersistence, there’s no reason to retain the discontinued monodevelop's SlnFile behavior.

these are all the “error” cases blocking this pr for two weeks, but none of them are actually relied upon for functionality. a note in the 9.0.2x docs like “we've switched to a new solution file library from the core vs team, replacing the old one from the discontinued monodevelop” should suffice to explain minor (git-diff visible) differences without impacting functionality.

@nagilson
Copy link
Member

running dotnet sln add foo.weirdproj currently results in:

  • project 'foo.weirdproj' has an unknown project type and cannot be added to the solution file. contact your sdk provider for support. — when the xml is valid
  • invalid project 'foo.weirdproj'. the project file could not be loaded. data at the root level is invalid. line 1, position 1. — when the xml is invalid

the second error reflects validation behavior that goes against the single responsibility principle, as dotnet sln add shouldn’t be responsible for project file validation (unlike dotnet build).

tests conforming to SlnFile behavior (that passing an explicit unknown guid should succeed) have no user-facing meaning because, fortunately, there is no guid argument in the dotnet sln add command. removing these tests and related special error handling would simplify the code.

if tools like vs, vscode, slngen, and the sdk are transitioning to vs-solutionpersistence, there’s no reason to retain the discontinued monodevelop's SlnFile behavior.

these are all the “error” cases blocking this pr for two weeks, but none of them are actually relied upon for functionality. a note in the 9.0.2x docs like “we've switched to a new solution file library from the core vs team, replacing the old one from the discontinued monodevelop” should suffice to explain minor (git-diff visible) differences without impacting functionality.

I think you raise good points. @edvilme chatted with me regarding this, and we think we can remove these error cases blocking this PR. We are also going to go over these error cases with the SLNX team to make sure that none of these old behaviors are behaviors they deem to be important to keep.

Most tests are now fixed. The rest are still pending due to design considerations and coordination with vs-solutionpersistence team
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants