diff --git a/src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs b/src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs index e7f5fd06f5..c5e7c378e4 100644 --- a/src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs +++ b/src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs @@ -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)); @@ -230,7 +231,12 @@ public static ProjectFileInfo Create( sourceFiles, references, projectReferences, analyzers, packageReferences); } - private static IList GetFullPaths(ICollection items) + private static bool ReferenceSourceTargetIsNotProjectReference(ProjectItemInstance item) + { + return item.GetMetadataValue(MetadataNames.ReferenceSourceTarget) != ItemNames.ProjectReference; + } + + private static IList GetFullPaths(IEnumerable items) { var sortedSet = new SortedSet(StringComparer.OrdinalIgnoreCase);