[Feature Request]: SolutionFile.Parse doesn't work with the new slnx file
virzak opened this issue · comments
Summary
The new slnx should be parsed using this library.
Previously mentioned here.
Background and Motivation
Can't switch to the new slnx file since I have a hook which runs dotnet tool run dotnet-format
.
Internally it calls MSBuildWorkspace.OpenSolutionAsync
which eventually calls SolutionFile.Parse
Current behaviour is:
Microsoft.Build.Exceptions.InvalidProjectFileException
HResult=0x80131500
Message=No file format header found. Q:\Code\Sandbox\ExampleSlnx\ExampleSlnx.slnx
Source=Microsoft.Build
StackTrace:
at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, String resourceName, Object[] args)
at Microsoft.Build.Construction.SolutionFile.ParseFileHeader()
at Microsoft.Build.Construction.SolutionFile.ParseSolution()
at Microsoft.Build.Construction.SolutionFile.ParseSolutionFile()
at Microsoft.Build.Construction.SolutionFile.Parse(String solutionFile)
Proposed Feature
Either parse using SolutionFile.Parse
and determine the format internally or use new API such as XmlSolutionFile.Parse
, SolutionFileX.Parse
. Not sure what's best.
Alternative Designs
No response
I wouldn't expect this to happen; instead I'd expect MSBuildWorkspace
to be updated to use a new library to parse .slnx
when/if such a thing is available. MSBuild will use the same library but wouldn't expose it through SolutionFile
, which is an internal implementation detail.
Such thing is already available: #1730 (comment)
No, there's no open-source library to parse .slnx
at this time. The VS team understands that there will need to be one.
Closing until we have specific concrete work to adopt the format.