Skip to content

Commit

Permalink
Merge pull request #815 from DustinCampbell/fix-project-refs
Browse files Browse the repository at this point in the history
Ensure that MSBuildProjectSystem doesn't add project references twice
  • Loading branch information
DustinCampbell authored Apr 6, 2017
2 parents 24fe1b0 + 6c7513a commit 402f921
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ public static ProjectFileInfo Create(
var projectAssetsFile = projectInstance.GetPropertyValue(PropertyNames.ProjectAssetsFile);

var sourceFiles = GetFullPaths(projectInstance.GetItems(ItemNames.Compile));
var references = GetFullPaths(projectInstance.GetItems(ItemNames.ReferencePath));
var references = GetFullPaths(
projectInstance.GetItems(ItemNames.ReferencePath).Where(ReferenceSourceTargetIsNotProjectReference));
var projectReferences = GetFullPaths(projectInstance.GetItems(ItemNames.ProjectReference));
var analyzers = GetFullPaths(projectInstance.GetItems(ItemNames.Analyzer));

Expand All @@ -230,7 +231,12 @@ public static ProjectFileInfo Create(
sourceFiles, references, projectReferences, analyzers, packageReferences);
}

private static IList<string> GetFullPaths(ICollection<ProjectItemInstance> items)
private static bool ReferenceSourceTargetIsNotProjectReference(ProjectItemInstance item)
{
return item.GetMetadataValue(MetadataNames.ReferenceSourceTarget) != ItemNames.ProjectReference;
}

private static IList<string> GetFullPaths(IEnumerable<ProjectItemInstance> items)
{
var sortedSet = new SortedSet<string>(StringComparer.OrdinalIgnoreCase);

Expand Down

0 comments on commit 402f921

Please sign in to comment.