create helper classes
This commit is contained in:
23
DotNetSolutionTools.Core/Common/SlnHelper.cs
Normal file
23
DotNetSolutionTools.Core/Common/SlnHelper.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.Build.Construction;
|
||||
|
||||
namespace DotNetSolutionTools.Core.Common;
|
||||
|
||||
public static class SlnHelper
|
||||
{
|
||||
public static SolutionFile? ParseSolutionFileFromPath(string solutionFilePath)
|
||||
{
|
||||
var solutionFile = SolutionFile.Parse(solutionFilePath);
|
||||
|
||||
return solutionFile;
|
||||
}
|
||||
|
||||
public static List<ProjectRootElement> GetCSharpProjectObjectsFromSolutionFile(SolutionFile solutionFile)
|
||||
{
|
||||
var projectList = solutionFile
|
||||
.ProjectsByGuid.Where(x => x.Value.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat)
|
||||
.Select(s => ProjectRootElement.Open(s.Value.AbsolutePath))
|
||||
.ToList();
|
||||
|
||||
return projectList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user