diff --git a/src/Microsoft.DotNet.Cli.Utils/Constants.cs b/src/Microsoft.DotNet.Cli.Utils/Constants.cs index ad5d5111d..81d485e11 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Constants.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Constants.cs @@ -18,6 +18,7 @@ namespace Microsoft.DotNet.Cli.Utils public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH"; public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath"; + public static readonly string EnableDefaultItems = "EnableDefaultItems"; public static readonly string ProjectArgumentName = ""; public static readonly string SolutionArgumentName = ""; diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index 8534c39d1..5969fdcab 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; using Microsoft.Build.Exceptions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; @@ -184,6 +184,9 @@ namespace Microsoft.DotNet.Tools.Run { var globalProperties = new Dictionary { + // 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 } }; @@ -197,7 +200,7 @@ namespace Microsoft.DotNet.Tools.Run globalProperties.Add("TargetFramework", Framework); } - Project project = new Project(Project, globalProperties, null); + var project = new ProjectInstance(Project, globalProperties, null); string runProgram = project.GetPropertyValue("RunCommand"); if (string.IsNullOrEmpty(runProgram)) @@ -220,7 +223,7 @@ namespace Microsoft.DotNet.Tools.Run .WorkingDirectory(runWorkingDirectory); } - private void ThrowUnableToRunError(Project project) + private void ThrowUnableToRunError(ProjectInstance project) { string targetFrameworks = project.GetPropertyValue("TargetFrameworks"); if (!string.IsNullOrEmpty(targetFrameworks))