Skip to content

Add support for the slnx solution file type #1640

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

timozn
Copy link

@timozn timozn commented Mar 26, 2025

Fixes #1639

Add support for the new .slnx Solution File Format to be recognized as a solution.

@josefpihrt
Copy link
Collaborator

@timozn Did you verify that it can load slnx file?

@timozn
Copy link
Author

timozn commented Apr 4, 2025

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: dotnet/msbuild#10794 and dotnet/msbuild#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 👍

@timozn timozn marked this pull request as draft April 4, 2025 19:50
@josefpihrt
Copy link
Collaborator

Ok, please let me know when this MR will be ready to be reviewed again. And thanks for your effort 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the .slnx Solution File Format in Roslynator CLI
2 participants