-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
slnx
support in the dotnet
CLI
#40913
Comments
Regarding the solution template, would it possible to exclude the byte order mark (BOM) now, or are there still known issues with VS or msbuild? I know that:
|
@glen-84 I'm inclined to make that change, but would like to discuss with @rainersigwald and the rest of the MSBuild team about any gaps there. |
For For |
I've reached out to the VS side to check compatibility with no-BOM. |
The VS team confirmed that slnx defaults to UTF-8 No-BOM, so we are clear to default the slnx template contents to no-BOM as well. I've updated the description to match this. |
Is there any concrete plan for this? I'm looking forward to build/test/restore support for slnx (also when referenced from a .slnf) so that we can update Sentry .NET SDK to use the new format.. Adding projects to the old format is so cumbersome when you need to keep a PR reviewable. |
We are still waiting for an official parser library for the new format to be made available by our partner teams. We're unable to make any progress without that library (and the stabilized format spec implied by that) |
related microsoft/slngen#585 |
if the plan is still to include slnx support in sdk 9.0, is there any estimate when parsing library is going to be available on github? |
Not at this time, no. |
even if it's not fully ready it can still be open sourced today and people can help fixing the remaining bugs in a few hours. someone did similar work starting five months ago https://github.com/winscripter/Slnx so they can collaborate with community |
|
Still waiting for this. |
It's not like slnx works very well in VS. It's an experimental preview feature. And even with VS, CI requires dotnet CLI. |
It's not a non-preview feature yet in VS (I believe the release notes still don't mention it at all), and the API isn't considered stable. |
A status update for those following this issue:
Our current plan is to try to merge this change and get support for building slnx files from the .NET SDK in a preview release of the 9.0.200 SDK, but that is subject to some timelines that we are still navigating. |
Proposal: In .NET 9.0, the default format ( |
@kasperk81 From the issue description:
Switching the defaults for .NET 10 is a fine plan, and is what we had been internally considering anyway. |
you can't build a solution from the cli with slnx files right now with 9.0 RC2... when is this fixed? Is there a work around? It makes the slnx standard useless in all but the hello world case. |
Reading is fundamental. Not sure how you can work on software legitimately when it's spelled out plain as day above that they are going to merge it into the 9.0.200 SDK which means based on past releases you won't be able to until the February 2025 release. |
@JohnGalt1717 here’s the order of tasks:
if you have time prepare a pr for task 5 |
The feature is scheduled for |
first version with the initial support is out https://github.com/dotnet/sdk/blob/main/documentation/package-table.md (9.0.2xx column) for now, manually write slnx
|
Understanding the support policy for .NET favors the even releases, once this is out in the wild with the the .NET 9 release, will the slnx support be brought back into .NET 8, or will we have to wait for 10 for LTS support with slnx in the sdk? The slnx format being so much simpler could be very useful for me with complex CICD scenarios - thinking of dynamic slnx files on the fly to target unit tests projects based on code changes, things of that nature. As we are currently bound to the LTS release for maintainability reasons, use of this feature for our team would possibly depend on it being brought into .NET 8 (or wait until 10) as we try to target the same sdk as our target framework (especially for containerized builds and tests where we start with the sdk base image). |
Semi-OT, but it sounds like https://github.com/microsoft/slngen might help you. |
that also doesn't support slnx yet microsoft/slngen#585 |
@kasperk81 I know. But the CI/CD, unit test, etc. use case sounded a bit like what slngen is trying to solve. |
I'm actually solving it currently with |
@richshadman have you considered using MSBuild projects that point to the projects you care about (maybe using Microsoft.Build.Traversal, instead of synthesizing solutions? Then you could have MSBuild conditions, and it'd probably be generally easier to debug. |
It did not occurred to me that projects could be used this way, I mean at this point what is the purpose of slnx/sln file when you can have a "meta project" (which already supports microsoft/vs-solutionpersistence#61 as well)? |
@alrz IMO |
I understand, but I suppose slnx needed dedicated support in tooling as well its own design and implementation. In my opinion it would have been ideal to add support for the sdk-based Traversal projects that existed for some time now instead of adding a completely new format... Just my 2c. |
The
dotnet
CLI should support the newslnx
format for building and in the existing solution management commands. It should also help interested users migrate to the new format.The new format
slnx
is an XML-based format that simplifies the currentsln
file format. When released, it will have an open-source parser, so tools like MSBuild and thedotnet
CLI can consistently operate on the format. The new format is intended to reduce common customer pains like merge conflicts and readability, but not to drastically change the experience of working with solutions.dotnet
experiences using solutionsThere are three primary ways that the
dotnet
CLI interacts with solution files todaydotnet build myapp.sln
dotnet sln myapp.sln add src/migrations
dotnet new solution -n lodestone
Each of these should be made to work with the new format to some degree. In addition, a fourth new capability should be added:
sln
toslnx
dotnet sln <sln file> migrate
Building solutions
This should be mostly transparent to the
dotnet
CLI. Much like solutions today, building a solution involves passing the path to the solution file to the MSBuild engine, which has the sole responsibility of converting the build configurations into a 'metaproject' - a kind of MSBuild representation that MSBuild can actually execute - and then building the requested targets on that metaproject.The same process would hold with
slnx
- the CLI would forward along theslnx
file provided (if any) and MSBuild itself would translate that file into a metaproject and execute that metaproject. Very few changes should be required in the CLI codebase to support this. MSBuild's tracking issue for this is dotnet/msbuild#10266.Manipulating solution content
The CLI has several commands that allow for adding and removing projects in a solution, as well as listing the existing projects. All of these commands should work with
slnx
as well. This is the area that will require the most investment. The CLI will need toslnx
files are valid inputs to these commandsslnx
filesThese commands allow for selection of the solution file. If invoked in a location where multiple potential solution files are present, the command should error and prompt the user to choose one of the possible solutions.
We'll also need to invest in test coverage to make sure we have parity between our
sln
support andslnx
support.Creating new solutions
The CLI currently ships a
solution
template that create a new, barebones solution file.We should provide a template that can create an empty
slnx
file for users to begin with. The new slnx template should use UTF-8 without a BOM. One major question: should we supplant the existingsolution
template to create anslnx
file? Should the old solution format be accessible via a template parameter?Migrating existing solutions
An entirely new capability to migrate a
sln
file to a newslnx
file should be implemented as well to ease onboarding and allow for automation. This command would load the existingsln
file and analyze it, translating it into an equivalentslnx
file. Ideally any data that matches the default conventions of the newslnx
format (for example, default build configurations likeDebug
andRelease
) could be omitted from the generatedslnx
file. The migrated slnx file will be written alongside the existing solution to allow for easy reverting/recovery of the change. The solution file to act upon will follow our existingSlnArgument
pattern - if an exact path is used, use that sln. If a directory is provided, and there is only one solution file, use that solution file. If a directory is provided and there are multiple solution files, error.Note that the addition of this slnx file will likely cause 'bare', unspecified MSBuild commands (like
dotnet build
without an explicit solution argument) as well asdotnet sln
commands with no arguments to fail when used in the working directory - this is acceptable. Users can test by explicitly building the new slnx, and then delete the previous .sln file when they are satisfied with the behaviors.References
The text was updated successfully, but these errors were encountered: