Merge pull request #8907 from peterhuene/no-run-glob
Prevent default item glgobing when evaluating run properties.
This commit is contained in:
commit
da9939e44d
2 changed files with 7 additions and 3 deletions
|
@ -18,6 +18,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH";
|
public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH";
|
||||||
public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath";
|
public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath";
|
||||||
|
public static readonly string EnableDefaultItems = "EnableDefaultItems";
|
||||||
|
|
||||||
public static readonly string ProjectArgumentName = "<PROJECT>";
|
public static readonly string ProjectArgumentName = "<PROJECT>";
|
||||||
public static readonly string SolutionArgumentName = "<SLN_FILE>";
|
public static readonly string SolutionArgumentName = "<SLN_FILE>";
|
||||||
|
|
|
@ -5,7 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Build.Evaluation;
|
using Microsoft.Build.Execution;
|
||||||
using Microsoft.Build.Exceptions;
|
using Microsoft.Build.Exceptions;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.Tools;
|
using Microsoft.DotNet.Tools;
|
||||||
|
@ -184,6 +184,9 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
{
|
{
|
||||||
var globalProperties = new Dictionary<string, string>
|
var globalProperties = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
// This property disables default item globbing to improve performance
|
||||||
|
// This should be safe because we are not evaluating items, only properties
|
||||||
|
{ Constants.EnableDefaultItems, "false" },
|
||||||
{ Constants.MSBuildExtensionsPath, AppContext.BaseDirectory }
|
{ Constants.MSBuildExtensionsPath, AppContext.BaseDirectory }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -197,7 +200,7 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
globalProperties.Add("TargetFramework", Framework);
|
globalProperties.Add("TargetFramework", Framework);
|
||||||
}
|
}
|
||||||
|
|
||||||
Project project = new Project(Project, globalProperties, null);
|
var project = new ProjectInstance(Project, globalProperties, null);
|
||||||
|
|
||||||
string runProgram = project.GetPropertyValue("RunCommand");
|
string runProgram = project.GetPropertyValue("RunCommand");
|
||||||
if (string.IsNullOrEmpty(runProgram))
|
if (string.IsNullOrEmpty(runProgram))
|
||||||
|
@ -220,7 +223,7 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
.WorkingDirectory(runWorkingDirectory);
|
.WorkingDirectory(runWorkingDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThrowUnableToRunError(Project project)
|
private void ThrowUnableToRunError(ProjectInstance project)
|
||||||
{
|
{
|
||||||
string targetFrameworks = project.GetPropertyValue("TargetFrameworks");
|
string targetFrameworks = project.GetPropertyValue("TargetFrameworks");
|
||||||
if (!string.IsNullOrEmpty(targetFrameworks))
|
if (!string.IsNullOrEmpty(targetFrameworks))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue