Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solution parsing (again!) #918

Merged
merged 4 commits into from
Jul 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/OmniSharp.MSBuild/MSBuildProjectSystem.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Build.Construction;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.Extensions.Configuration;
@@ -18,6 +17,7 @@
using OmniSharp.MSBuild.Models.Events;
using OmniSharp.MSBuild.ProjectFile;
using OmniSharp.MSBuild.Resolution;
using OmniSharp.MSBuild.SolutionParsing;
using OmniSharp.Options;
using OmniSharp.Services;

@@ -138,13 +138,13 @@ private IEnumerable<string> GetProjectPathsFromSolution(string solutionFilePath)
{
_logger.LogInformation($"Detecting projects in '{solutionFilePath}'.");

var solutionFile = SolutionFile.Parse(solutionFilePath);
var solutionFile = SolutionFile.ParseFile(solutionFilePath);
var processedProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var result = new List<string>();

foreach (var project in solutionFile.ProjectsInOrder)
foreach (var project in solutionFile.Projects)
{
if (project.ProjectType == SolutionProjectType.SolutionFolder)
if (project.IsSolutionFolder)
{
continue;
}
4 changes: 4 additions & 0 deletions src/OmniSharp.MSBuild/SolutionParsing/ProjectBlock.cs
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@ namespace OmniSharp.MSBuild.SolutionParsing
{
internal class ProjectBlock
{
private const string SolutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";

// An example of a project line looks like this:
// Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{DEBCE986-61B9-435E-8018-44B9EF751655}"
private static readonly Lazy<Regex> s_lazyProjectHeader = new Lazy<Regex>(
@@ -30,6 +32,8 @@ internal class ProjectBlock
public string ProjectGuid { get; }
public ImmutableArray<SectionBlock> Sections { get; }

public bool IsSolutionFolder => ProjectTypeGuid.Equals(SolutionFolderGuid, StringComparison.OrdinalIgnoreCase);

private ProjectBlock(string projectTypeGuid, string projectName, string relativePath, string projectGuid, ImmutableArray<SectionBlock> sections)
{
ProjectTypeGuid = projectTypeGuid;