Open baronfel opened 3 months ago
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 .sln
I would leave it as it has been (I believe that's the longstanding Windows 16-bit chars with BOM).
For .slnx
we should definitely avoid the BOM but would need to check with the VS folks to make sure they agree.
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)
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 [-o <slnx file name>]
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 https://github.com/dotnet/msbuild/issues/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.References