Skip to content

Add support for .slnx solution references#450

Open
gteijeiro wants to merge 1 commit intowaf:mainfrom
gteijeiro:codex/add-slnx-support
Open

Add support for .slnx solution references#450
gteijeiro wants to merge 1 commit intowaf:mainfrom
gteijeiro:codex/add-slnx-support

Conversation

@gteijeiro
Copy link

Summary

  • add .slnx support to the solution reference resolver used by #r
  • add a regression test and version a demo .slnx file in test data
  • update help text and README to mention .slnx solution references

Validation

  • built the project locally with dotnet build CSharpRepl/CSharpRepl.csproj -c Debug
  • verified #r ".../DemoSolution.slnx" now builds the solution and adds references when running the local binary

Copilot AI review requested due to automatic review settings March 15, 2026 00:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds .slnx support to the #r solution/project reference resolver, along with documentation and test coverage to prevent regressions.

Changes:

  • Extend solution reference resolution to accept .slnx in addition to .sln.
  • Add a regression test and a demo .slnx file under test data.
  • Update README and in-app help text to mention .slnx references.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents that #r supports .slnx solution references.
CSharpRepl/ReadEvalPrintLoop.cs Updates help text to include .slnx examples for #r.
CSharpRepl.Tests/EvaluationTests.cs Adds a regression test that references a .slnx solution.
CSharpRepl.Tests/Data/DemoSolution/DemoSolution.slnx Adds a demo .slnx file used by the new test.
CSharpRepl.Services/Roslyn/MetadataResolvers/SolutionFileMetadataResolver.cs Extends resolver to recognize and open .slnx solutions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 28 to 34
public override bool CanResolve(string reference) =>
reference.EndsWith(".sln", StringComparison.OrdinalIgnoreCase) ||
reference.EndsWith(".sln\"", StringComparison.OrdinalIgnoreCase) ||
reference.EndsWith(".slnx", StringComparison.OrdinalIgnoreCase) ||
reference.EndsWith(".slnx\"", StringComparison.OrdinalIgnoreCase) ||
reference.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
reference.EndsWith(".csproj\"", StringComparison.OrdinalIgnoreCase);
Comment on lines 59 to 64
var projects = Path.GetExtension(solutionOrProject) switch
{
".csproj" => [await workspace.OpenProjectAsync(solutionOrProject, cancellationToken: cancellationToken)],
".sln" => (await workspace.OpenSolutionAsync(solutionOrProject, cancellationToken: cancellationToken)).Projects,
".sln" or ".slnx" => (await workspace.OpenSolutionAsync(solutionOrProject, cancellationToken: cancellationToken)).Projects,
_ => throw new ArgumentException("Unexpected filetype for file " + solutionOrProject)
};
Comment on lines +159 to +169
[Fact]
public async Task Evaluate_SolutionReference_ReferencesAllProjects_FromSlnx()
{
var referenceResult = await services.EvaluateAsync(@"#r ""./Data/DemoSolution/DemoSolution.slnx""");
var importProject1Result = await services.EvaluateAsync(@"using DemoSolution.DemoProject1;");
var importProject2Result = await services.EvaluateAsync(@"using DemoSolution.DemoProject2;");

Assert.IsType<EvaluationResult.Success>(referenceResult);
Assert.IsType<EvaluationResult.Success>(importProject1Result);
Assert.IsType<EvaluationResult.Success>(importProject2Result);
}
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.

2 participants