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,
|
IEnumerable<string> args,
|
||||||
string projectDirectory)
|
string projectDirectory)
|
||||||
{
|
{
|
||||||
var projectContext = GetProjectContextFromDirectory(projectDirectory, s_toolPackageFramework);
|
var projectContext = GetProjectContextFromDirectoryForFirstTarget(projectDirectory);
|
||||||
|
|
||||||
if (projectContext == null)
|
if (projectContext == null)
|
||||||
{
|
{
|
||||||
|
@ -162,29 +162,19 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
s_toolPackageFramework);
|
s_toolPackageFramework);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectContext GetProjectContextFromDirectory(string directory, NuGetFramework framework)
|
private ProjectContext GetProjectContextFromDirectoryForFirstTarget(string projectRootPath)
|
||||||
{
|
{
|
||||||
if (directory == null || framework == null)
|
if (projectRootPath == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var projectRootPath = directory;
|
|
||||||
|
|
||||||
if (!File.Exists(Path.Combine(projectRootPath, Project.FileName)))
|
if (!File.Exists(Path.Combine(projectRootPath, Project.FileName)))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var projectContext = ProjectContext.Create(
|
var projectContext = ProjectContext.CreateContextForEachTarget(projectRootPath).FirstOrDefault();
|
||||||
projectRootPath,
|
|
||||||
framework,
|
|
||||||
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
|
|
||||||
|
|
||||||
if (projectContext.RuntimeIdentifier == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return projectContext;
|
return projectContext;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue