diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2018-01-10 20:26:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-10 20:26:08 +0300 |
commit | b877a7cc173bde8fd6f8d0ccc21bae042ea95ef4 (patch) | |
tree | 6c76d075f8cf7a506f65055d7fb7758906c13274 | |
parent | 040caa41df15db2bd854ad832960f33c373e3647 (diff) | |
parent | b1b8cb7459277dc409d2df3b6597f62fd88258c1 (diff) |
Merge pull request #3557 from mono/d15-6-fix-project-ref-to-shared-project-considered-invalid
[d15-6][Core] Fix project reference to shared project considered invalid
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs | 9 | ||||
-rw-r--r-- | main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SharedAssetsProjectTests.cs | 17 |
2 files changed, 22 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs index 12d4b8176f..16d346564f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs @@ -492,13 +492,14 @@ namespace MonoDevelop.Projects } } else if (ReferenceType == ReferenceType.Project) { if (ownerProject != null && ownerProject.ParentSolution != null && ReferenceOutputAssembly) { - DotNetProject p = ResolveProject (ownerProject.ParentSolution) as DotNetProject; - if (p != null) { + var p = ResolveProject (ownerProject.ParentSolution); + var dotNetProject = p as DotNetProject; + if (dotNetProject != null) { string reason; - if (!ownerProject.CanReferenceProject (p, out reason)) + if (!ownerProject.CanReferenceProject (dotNetProject, out reason)) return reason; - } else + } else if (p == null) return GettextCatalog.GetString ("Project not found"); } } else if (ReferenceType == ReferenceType.Assembly) { diff --git a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SharedAssetsProjectTests.cs b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SharedAssetsProjectTests.cs index 347aff8d36..129a08b668 100644 --- a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SharedAssetsProjectTests.cs +++ b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SharedAssetsProjectTests.cs @@ -530,6 +530,23 @@ namespace MonoDevelop.Projects sol.Dispose (); } + + [Test] + public async Task ProjectReferenceToSharedProjectThatExistsIsValid () + { + string solFile = Util.GetSampleProject ("SharedProjectTest", "SharedProjectTest.sln"); + Solution sol = (Solution)await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile); + + var pcs = sol.FindProjectByName ("Shared"); + var pc1 = (DotNetProject)sol.FindProjectByName ("Console1"); + + var r = pc1.References.FirstOrDefault (re => re.Reference == "Shared"); + Assert.IsNotNull (r); + Assert.AreEqual (string.Empty, r.ValidationErrorMessage); + Assert.IsTrue (r.IsValid); + + sol.Dispose (); + } } } |