Microsoft previews new XML format for Visual Studio solutions – but replacing a longstanding format is a messy business

Microsoft previews new XML format for Visual Studio solutions – but replacing a longstanding format is a messy business

Microsoft has introduced a new XML-based format for Visual Studio solution files, replacing a long-standing text format and making merge conflicts less likely, but migrating from one to the other may not be straightforward.

Visual Studio uses solution files to manage multiple projects, and even a single-project application requires one. They are not essential for those working outside Visual Studio, such as with Visual Studio Code (VS Code), and there is debate about whether they are necessary. The format is verbose and uses GUIDs – long globally unique identifiers – which are not good for human readability. 

Solution files have also proved a common source of merge conflicts in team development environments, and when they are corrupted Visual Studio can no longer open the application.

The company has therefore come up with a new XML-based format which in principle has many advantages. The new format is more concise, human-readable, preserves white space and comments, and aligns with MSBuild conventions, according to senior product manager Nayana Srikanth. Developers can convert to the new format using Save As in Visual Studio and choosing the new format, though it may be necessary to enable preview features before this works.

Srikanth said that the company chose XML rather than other formats such as JSON because it is the same format used by Visual Studio project files.

While that all sounds good, there are a number of problems with migrating, such that Srikanth “recommends waiting until it’s more finalized before fully adopting it.”

There is some friction in using a .SLNX file (the new format) in place of the old .SLN format. Visual Studio has to have SLNX enabled otherwise solutions in the new format will not load. Another problem is that third-party tools and extensions may be incompatible; and a further issue is that having both .SLN and .SLNX files in the same repository is strongly discouraged, but may be necessary during migration. Visual Studio will not keep them in sync as changes are made, though there is an experimental community tool called slnxsync that can do this. The nuget package manager does not yet support SLNX though it may do soon as a patch for this has been submitted.

.NET developers not using Visual Studio can use the latest version of the .NET SDK, 9.0.200, which includes a command to migrate solution files to the new format.

One thing which makes migration easier is the existence of vs-solutionpersistence, a library for editing solution files which supports both formats transparently.

Developers are in general positive about the move, though with reservations about compatibility issues. “I’ve been waiting for a revamp of solution files for years. It was one of the last remnants of an old project system, and didn’t match to the new SDK-style projects at all,” said one.