Skip to content

Conversation

@Aaronontheweb
Copy link
Member

Summary

Adds full support for the new XML-based .slnx solution format in both Workspace and Static Graph build engines.

Changes

  • Upgraded MSBuild from 17.11.48 to 17.14.28 (.slnx support added in 17.12.6 via .SLNX format support dotnet/msbuild#10794)
  • Upgraded Roslyn from 4.14.0 to 5.0.0-2.final (.slnx support added via Add XML Solution (SLNX) support to MSBuildWorkspace dotnet/roslyn#77326)
  • Upgraded target framework from net8.0 to net9.0 (required by MSBuild 17.12.6+)
  • Added Microsoft.CodeAnalysis.Common package reference (previously transitive)
  • Updated deprecated Workspace.WorkspaceFailed API to RegisterWorkspaceFailedHandler
  • Added test coverage for .slnx format:
    • WorkspaceSlnx test class (6 tests)
    • StaticGraphSlnx test class (6 tests)

Test Results

All 14 .slnx tests passing:

  • ✅ WorkspaceSlnx: 6/6 passed
  • ✅ StaticGraphSlnx: 6/6 passed
  • ✅ Other .slnx tests: 2/2 passed

Fixes #405

Upgraded dependencies and target framework to enable full support for the new XML-based .slnx solution format in both Workspace and Static Graph build engines.

Changes:
- Upgraded MSBuild from 17.11.48 to 17.14.28 (.slnx support added in 17.12.6)
- Upgraded Roslyn from 4.14.0 to 5.0.0-2.final (.slnx support added in this version)
- Upgraded target framework from net8.0 to net9.0 (required by MSBuild 17.12.6+)
- Added Microsoft.CodeAnalysis.Common package reference
- Updated deprecated Workspace.WorkspaceFailed API to RegisterWorkspaceFailedHandler
- Added test coverage for .slnx format in both WorkspaceSlnx and StaticGraphSlnx test classes

All tests passing (14/14 .slnx tests).

Fixes petabridge#405
Roslyn 5.0+ no longer supports loading F# projects even with AssociateFileExtensionWithLanguage workaround.

Changes:
- Switched F# test to use StaticGraphBuildEngine (which uses MSBuild's ProjectGraph API)
- Added workspace configuration with SkipUnrecognizedProjects=false
- Added diagnostic logging for loaded projects
- Updated F# test project samples from netcoreapp2.2 to net8.0

StaticGraphBuildEngine works with F# projects because it doesn't rely on Roslyn's language-specific support.

All 143 tests now passing.
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed my changes

<PackAsTool>true</PackAsTool>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to run on .NET 9 in order to access some of the newer Roslyn APIs

private readonly MSBuildWorkspace _msBuild = MSBuildWorkspace.Create();
private readonly MSBuildWorkspace _msBuild = CreateWorkspace(logger);

private static MSBuildWorkspace CreateWorkspace(ILogger logger)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the non-default MSBuild implementation

public const string ProjectC = "ProjectC";

private static TestSolutionModel CreateSolution()
private static TestSolutionModel CreateSolution(SolutionFormat format = SolutionFormat.Sln)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it possible to emit both .sln and .slnx solutions

var settings = new BuildSettings("master", new RelativePath("FSharpSolution.sln"), Repository.BasePath, [],
[], "dotnet");
var emitTask = new EmitDependencyGraphTask(settings, new WorkspaceBuildEngine(logger), logger, CancellationToken.None);
// Note: Using StaticGraphBuildEngine instead of WorkspaceBuildEngine because Roslyn 5.0+ does not support F# projects
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to make this clearer in the release notes

<Authors>Petabridge</Authors>
<VersionPrefix>1.1.0</VersionPrefix>
<PackageReleaseNotes>**Major New Features &amp; Improvements:**
<VersionPrefix>1.2.0-beta.1</VersionPrefix>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet pack will complain about us referencing a non-stable package if we're trying to build a stable release version.

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.

Roslyn / MSBuild can't open .slnx files

1 participant