fixes #1858
This commit is contained in:
parent
850e02a1ce
commit
07f3d60355
1 changed files with 4 additions and 14 deletions
|
@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
IEnumerable<string> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue