From 07f3d60355cf0b84b5aa5e89bd4921b5b17ac44b Mon Sep 17 00:00:00 2001 From: Bryan Date: Wed, 23 Mar 2016 12:40:10 -0700 Subject: [PATCH] fixes #1858 --- .../ProjectToolsCommandResolver.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index e49c4192e..6fb25415a 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Utils IEnumerable args, string projectDirectory) { - var projectContext = GetProjectContextFromDirectory(projectDirectory, s_toolPackageFramework); + var projectContext = GetProjectContextFromDirectoryForFirstTarget(projectDirectory); if (projectContext == null) { @@ -162,29 +162,19 @@ namespace Microsoft.DotNet.Cli.Utils s_toolPackageFramework); } - private ProjectContext GetProjectContextFromDirectory(string directory, NuGetFramework framework) + private ProjectContext GetProjectContextFromDirectoryForFirstTarget(string projectRootPath) { - if (directory == null || framework == null) + if (projectRootPath == null) { return null; } - var projectRootPath = directory; - if (!File.Exists(Path.Combine(projectRootPath, Project.FileName))) { return null; } - var projectContext = ProjectContext.Create( - projectRootPath, - framework, - PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); - - if (projectContext.RuntimeIdentifier == null) - { - return null; - } + var projectContext = ProjectContext.CreateContextForEachTarget(projectRootPath).FirstOrDefault(); return projectContext; }