Skip to content

Conversation

@wgnf
Copy link
Contributor

@wgnf wgnf commented Nov 28, 2025

Closes #4520

As discussed in the above-mentioned issue I have added support for .slnx Solution files without any third-party library.

I have added the exact same tests as for the .sln files, using dotnet sln migrate to migrate the used .sln files to .slnx and keeping the assertions. That way, I could make sure that there aren't any regressions.

There are few things to point out:

  • The new .slnx format does not provide any IDs anymore, as cross-references between things in the Solution are not necessary anymore. The SolutionProject still has a mandatory ID however (and I didnt't want to make breaking changes to that). So I just submitted string.Empty to the ID
  • .sln and .slnx files support nested folders. In .slnx files these are modeled using the name of a solution-folder (i.e. Root is the root folder, and Root/Sub is the folder "Sub" underneath that Root-Folder). To not make things too complicated for now, I did not adhere to that consideration just yet (for the above-mentioned example, the "Root" SolutionFolder would not have an instance of the "Sub" SolutionFolder). If that is something that you want to see, I can make sure to respect that
  • I have unfortunately no idea if there are any documentation hints that I would need to extend to make sure that users know that .slnx files are now also supported

If something is unclear here in the PR or in the code, please feel free to reach out :)

@wgnf
Copy link
Contributor Author

wgnf commented Nov 28, 2025

@microsoft-github-policy-service agree

@wgnf
Copy link
Contributor Author

wgnf commented Nov 28, 2025

Seems like the pipelines are failing however. Is that something I have to worry about?

@gep13
Copy link
Member

gep13 commented Nov 28, 2025

@wgnf said...
Seems like the pipelines are failing however. Is that something I have to worry about?

Yes, this is absolutely something that we need to worry about 😄

Looks like your changes are failing one of the StyleCop rules that we have in place.

It could be that some newer syntax that you are using is causing a rule to be tripped.

@wgnf
Copy link
Contributor Author

wgnf commented Nov 28, 2025

Ahh, I guess the [] is making an issue. I can go ahead and change that.

@wgnf wgnf force-pushed the feature/GH-4520-add-slnx-parsing branch from 75d5791 to 4c2e0d1 Compare November 28, 2025 19:49
@kasperk81
Copy link

@wgnf, you can run it through this test suite https://github.com/microsoft/vs-solutionpersistence/tree/main/test/Microsoft.VisualStudio.SolutionPersistence.Tests/SlnAssets to iron out corner cases. i.e. serializeToXml(deserialize(<name>.sln.txt)) == <name>.slnx.xml

As someone who added slnx support in dotnet new sln -f slnx, on github linguist for ```slnx and .slnx syntax highlighting, then participated in whole msbuild and sdk integration process, I can tell you with confidence that there are many corner cases handled in their parser; which is why i was rooting for using official parser that was rejected by the maintainer

@wgnf
Copy link
Contributor Author

wgnf commented Nov 28, 2025

@kasperk81

Maybe the full-fledged support using the third-party library you mentioned, supporting all the edge-cases there might be, is something that can be done in a separate AddIn, as already mentioned in the Issue.

I guess, but I might be alone on this, simple .sln (that is already there) and .slnx, that does not support all the edge-cases, is ok for the core-library, as it adds the functionality for most use-cases.

@wgnf
Copy link
Contributor Author

wgnf commented Nov 28, 2025

The current pipeline error is the following:

/home/runner/work/cake/cake/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj(25,4): error MSB3733: Input file "templates/cakefrosting/build/Build.csproj" cannot be opened. The process cannot access the file '/home/runner/work/cake/cake/src/Cake.Frosting.Template/templates/cakefrosting/build/Build.csproj' because it is being used by another process. [TargetFramework=net8.0]

Seems like some race-condition, but not something caused by my changes, to me?

@devlead
Copy link
Member

devlead commented Nov 28, 2025

The current pipeline error is the following:

/home/runner/work/cake/cake/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj(25,4): error MSB3733: Input file "templates/cakefrosting/build/Build.csproj" cannot be opened. The process cannot access the file '/home/runner/work/cake/cake/src/Cake.Frosting.Template/templates/cakefrosting/build/Build.csproj' because it is being used by another process. [TargetFramework=net8.0]

Seems like some race-condition, but not something caused by my changes, to me?

Yes, likely a file in use; I've seen the .NET 10 SDK holding on to files a bit more at times.

@kasperk81
Copy link

that does not support all the edge-cases, is ok for the core-library, as it adds the functionality for most use-cases.

I'm not sure what you meant by "all the edge cases". Did you find concrete results from that test suite like x/N cases are not handled such that those x case are unlikely to happen in reality and hence considered "edge cases"?

@wgnf
Copy link
Contributor Author

wgnf commented Nov 29, 2025

No, I have not used that suite yet.

@devlead
Copy link
Member

devlead commented Nov 29, 2025

No, I have not used that suite yet.

They're likely be edge cases, but add a couple integration tests here
https://github.com/cake-build/cake/blob/develop/tests/integration/Cake.Common/Solution/SolutionAliases.cake

Test solutions are added and copied from here
https://github.com/cake-build/cake/tree/develop/tests/integration/resources/Cake.Common/Solution

And we then we can always add more tests if a new edge case or actual issue should arise.
But if dotnet new, Cake slnx and the unit tests ones work, then we've got a good starting point.

@kasperk81
Copy link

Something not in Slnx.xsd schema is considered edge case? or what is the definition of edge case here?

We should at least gather the data what is not going to be supported and write it down in unit test in terms of: what is the expected behavior of cake when such content is provided that is understood by msbuild/vscode but rejected by cake.

@devlead
Copy link
Member

devlead commented Nov 29, 2025

Something not in Slnx.xsd schema is considered edge case? or what is the definition of edge case here?

We should at least gather the data what is not going to be supported and write it down in unit test in terms of: what is the expected behavior of cake when such content is provided that is understood by msbuild/vscode but rejected by cake.

To be clear, with edge cases, we mean things not needed, known or tested at this point.

We've not reviewed PR yet, but if it handles similar scenarios as existing sln parser, it'll likely be a good starting point. To fully handle everything string possible in format today or in the future is out of scope. For that we recommend creating an addin with official parser(or just reference it). 100% spec compliance is out of scope, if other common needs come up we can add more test scenarios and sort those.

@wgnf
Copy link
Contributor Author

wgnf commented Nov 29, 2025

I just added two simple integration tests for .slnx files. I wanted to do something more complex too, but then I realized:

  • The SolutionProjectEqualityComparer that is used for the solution-file integration-tests also checks for the parent of a project (see here], which I would expect and want
  • but the Parent property of the SolutionProject is internal set; (see here), which makes it impossible to set up an "expected" SolutionProject in the integration test, when dealing with solution folders

And this is something I don't feel comfortable changing.

Or am I missing something that I could to, to be able to set up an integration-test considering these restrictions?

@devlead
Copy link
Member

devlead commented Nov 29, 2025

@wgnf you can add completely new tests that you see appropriate, important part is we test the alias works as expected with real files and cake script context.

@wgnf
Copy link
Contributor Author

wgnf commented Nov 29, 2025

Yeah, I've already gone ahead and added two integration tests

Copy link
Member

@devlead devlead left a comment

Choose a reason for hiding this comment

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

Quick initial look, and this looks good to me, some minor comments. Will take a deeper look as soon as I can.

@wgnf
Copy link
Contributor Author

wgnf commented Dec 1, 2025

Thanks for the fast feedback! I think I'll be able to adress the requests later this week or on the weekend.

@devlead
Copy link
Member

devlead commented Dec 1, 2025

Thanks for the fast feedback! I think I'll be able to adress the requests later this week or on the weekend.

Excellent, let us know if any questions arise.

@wgnf wgnf force-pushed the feature/GH-4520-add-slnx-parsing branch 3 times, most recently from a23be00 to 51e604e Compare December 6, 2025 16:38
@gep13 gep13 changed the title GH-4520 add slnx support to SolutionParser GH4520: add slnx support to SolutionParser Dec 6, 2025
@gep13 gep13 mentioned this pull request Dec 6, 2025
@wgnf
Copy link
Contributor Author

wgnf commented Dec 9, 2025

I integrated the requested changes. The Azure Pipeline has problems with a hanging process again however :/

@devlead devlead force-pushed the feature/GH-4520-add-slnx-parsing branch from 51e604e to d19be3a Compare December 9, 2025 16:45
Copy link
Member

@devlead devlead left a comment

Choose a reason for hiding this comment

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

LGMT 👍

@devlead devlead merged commit 40fff77 into cake-build:develop Dec 10, 2025
15 of 17 checks passed
@devlead
Copy link
Member

devlead commented Dec 10, 2025

@wgnf your changes have been merged, thanks for your contribution 👍

@wgnf wgnf deleted the feature/GH-4520-add-slnx-parsing branch December 10, 2025 12:33
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.

add slnx support

4 participants