Skip to content

Commit

Permalink
Major change: Added support for all projects.
Browse files Browse the repository at this point in the history
Looping the solution will return more projects than before where it only returned specific projects.
  • Loading branch information
janstaelensskyline committed Mar 27, 2024
1 parent c45aac1 commit 61dc696
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void AutomationScriptCompiler_Solution3_Load()
Assert.AreEqual(path, solution.SolutionPath);
Assert.AreEqual(Path.GetDirectoryName(path), solution.SolutionDirectory);

Assert.AreEqual(3, solution.Projects.Count());
Assert.AreEqual(4, solution.Projects.Count());
Assert.AreEqual(2, solution.Scripts.Count());

var script1 = solution.Scripts.FirstOrDefault(s => s.Script.Name == "Script_1").Script;
Expand Down
8 changes: 8 additions & 0 deletions Parsers.Common/VisualStudio/Projects/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Xml.Linq;

Expand Down Expand Up @@ -136,11 +137,18 @@ private Project()
/// <exception cref="FileNotFoundException">The file specified in <paramref name="path"/> does not exist.</exception>
public static Project Load(string path, string projectName)
{
List<string> supportedExtensions = new List<string>() {".csproj", ".projitems", ".shproj" };

if (!FileSystem.File.Exists(path))
{
throw new FileNotFoundException("Could not find project file: " + path);
}

if (!supportedExtensions.Contains(FileSystem.Path.GetExtension(path)))
{
throw new NotImplementedException("Project Load does not support this project type.");
}

// Make sure to use the full path
path = FileSystem.Path.GetFullPath(path);

Expand Down
6 changes: 1 addition & 5 deletions Parsers.Common/VisualStudio/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,9 @@ private void ProcessProject(SolutionParser.Model.SlnProject p)
}
}
}
else if (p.TypeGuid == SolutionProjectTypeIDs.MsBuildProject || p.TypeGuid == SolutionProjectTypeIDs.NetCoreProject)
{
solutionItem = new ProjectInSolution(this, p);
}
else
{
return;
solutionItem = new ProjectInSolution(this, p);
}

AddSolutionItem(solutionItem.Guid, solutionItem);
Expand Down

0 comments on commit 61dc696

Please sign in to comment.