get msbuild eval projects

This commit is contained in:
Matt Parker
2025-08-07 18:12:41 +10:00
parent f18ecc9c6b
commit 082a3a6bbf
4 changed files with 27 additions and 12 deletions

View File

@@ -0,0 +1,20 @@
using Ardalis.GuardClauses;
using Microsoft.Build.Evaluation;
namespace SharpIDE.Application.Features.ProjectIntrospection;
public static class Test
{
private static readonly ProjectCollection _projectCollection = ProjectCollection.GlobalProjectCollection;
public static async Task<Project> GetProject(string projectFilePath)
{
Guard.Against.Null(projectFilePath, nameof(projectFilePath));
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
var project = _projectCollection.LoadProject(projectFilePath);
Console.WriteLine($"Project loaded: {project.FullPath}");
//var outputType = project.GetProperty("OutputType");
return project;
}
}