I examined the project a little. I want to share a few things that caught my eye,
- Correct API Usage: The MSBuild API has changed, and directly loading a solution file using ProjectCollection.GlobalProjectCollection.LoadProject might not work. You should use the SolutionFile class from Microsoft.Build.Construction to parse the solution file.
- Check Compatibility: Ensure the versions of Microsoft.Build and Microsoft.Build.Locator are compatible with .NET 8.
Replace the ParseSolution method in MainWindow.xaml.cs with the following:
using Microsoft.Build.Construction;
private void ParseSolution()
{
string solutionPath = @"path\to\your\solution.sln";
var solution = SolutionFile.Parse(solutionPath);
foreach (var project in solution.ProjectsInOrder)
{
OutputTextBox.Text += project.AbsolutePath + "\n";
}
}
This should correctly parse the solution file and list the projects within it.
Make these changes and see if the issue is resolved.