roslynator
roslynator copied to clipboard
Add support for the slnx solution file type
Fixes #1639
Add support for the new .slnx Solution File Format to be recognized as a solution.
@timozn Did you verify that it can load slnx file?
Unfortunately it breaks at a different location now:
I build the NuGet Package and installed from local source:
When running, it cannot open the slnx solution for analysis.
roslynator analyze SwitchNetManager.slnx -o output.file
Loading solution '/home/timo/Projects/dotnet/switchnetmanager/SwitchNetManager.slnx'...
System.AggregateException: One or more errors occurred. (No file format header found. /home/timo/Projects/dotnet/switchnetmanager/SwitchNetManager.slnx)
---> Microsoft.Build.Exceptions.InvalidProjectFileException: No file format header found. /home/timo/Projects/dotnet/switchnetmanager/SwitchNetManager.slnx
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)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.OpenProjectOrSolutionAsync(String path, MSBuildWorkspace workspace, IProgress`1 progress, CancellationToken cancellationToken) in /home/timo/Projects/playground/roslynator/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 242
at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(String path, MSBuildWorkspace workspace, CancellationToken cancellationToken) in /home/timo/Projects/playground/roslynator/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 151
at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(IEnumerable`1 paths, String msbuildPath, IEnumerable`1 properties) in /home/timo/Projects/playground/roslynator/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 89
at Roslynator.CommandLine.Program.AnalyzeAsync(AnalyzeCommandLineOptions options) in /home/timo/Projects/playground/roslynator/src/CommandLine/Program.cs:line 343
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Roslynator.CommandLine.Program.<>c.<Main>b__0_3(MSBuildCommandLineOptions options) in /home/timo/Projects/playground/roslynator/src/CommandLine/Program.cs:line 175
at CommandLine.ParserResultExtensions.MapResult[T1,T2,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 notParsedFunc)
at Roslynator.CommandLine.Program.Main(String[] args) in /home/timo/Projects/playground/roslynator/src/CommandLine/Program.cs:line 169
The Issue seems to be, that msbuild does not yet support to parse slnx files.
There are Tickets that will take care of this: https://github.com/dotnet/msbuild/pull/10794 and https://github.com/dotnet/msbuild/issues/10266
But the planned support for MsBuild 17.13 was revoked and is now planned for 17.14, if I see that correctly.
Thanks for having me checking that first :+1:
Ok, please let me know when this MR will be ready to be reviewed again. And thanks for your effort 👍
Implemented in https://github.com/dotnet/roslynator/pull/1662