get msbuild eval projects
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,15 +37,6 @@ public static class GetNodesInSolution
|
|||||||
.ToList();
|
.ToList();
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Folder> GetFoldersInProject(string projectPath)
|
|
||||||
{
|
|
||||||
var files = GetFilesInProject(projectPath);
|
|
||||||
var rootDirectoryOfProject = new DirectoryInfo(Path.GetDirectoryName(projectPath)!);
|
|
||||||
|
|
||||||
var grouped = files.GroupBy(s => s.Directory!.FullName);
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
using Microsoft.Build.Evaluation;
|
||||||
|
|
||||||
|
namespace SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
|
||||||
public interface ISharpIdeNode;
|
public interface ISharpIdeNode;
|
||||||
|
|
||||||
@@ -24,4 +26,5 @@ public class SharpIdeProjectModel : ISharpIdeNode
|
|||||||
public required List<SharpIdeFolder> Folders { get; set; }
|
public required List<SharpIdeFolder> Folders { get; set; }
|
||||||
public required List<SharpIdeFile> Files { get; set; }
|
public required List<SharpIdeFile> Files { get; set; }
|
||||||
public bool Expanded { get; set; }
|
public bool Expanded { get; set; }
|
||||||
|
public required Task<Project> MsBuildEvaluationProject { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using SharpIDE.Application.Features.ProjectIntrospection;
|
||||||
|
|
||||||
namespace SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
namespace SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
|
||||||
@@ -34,8 +35,8 @@ public static class VsPersistenceMapper
|
|||||||
Name = projectModel.Model.ActualDisplayName,
|
Name = projectModel.Model.ActualDisplayName,
|
||||||
FilePath = projectModel.FullFilePath,
|
FilePath = projectModel.FullFilePath,
|
||||||
Files = TreeMapperV2.GetFiles(projectModel.FullFilePath),
|
Files = TreeMapperV2.GetFiles(projectModel.FullFilePath),
|
||||||
Folders = TreeMapperV2.GetSubFolders(projectModel.FullFilePath)
|
Folders = TreeMapperV2.GetSubFolders(projectModel.FullFilePath),
|
||||||
|
MsBuildEvaluationProject = Test.GetProject(projectModel.FullFilePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static SharpIdeSolutionFolder GetSharpIdeSolutionFolder(IntermediateSlnFolderModel folderModel) => new SharpIdeSolutionFolder()
|
private static SharpIdeSolutionFolder GetSharpIdeSolutionFolder(IntermediateSlnFolderModel folderModel) => new SharpIdeSolutionFolder()
|
||||||
|
|||||||
Reference in New Issue
Block a user