diff --git a/src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs b/src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs index dffbbc0bfab3..eed2437e281c 100644 --- a/src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs +++ b/src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs @@ -17,7 +17,6 @@ internal static class CommonRunHelpers public static Dictionary GetGlobalPropertiesFromArgs(MSBuildArgs msbuildArgs) { var globalProperties = msbuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary(StringComparer.OrdinalIgnoreCase); - globalProperties[Constants.EnableDefaultItems] = "false"; // Disable default item globbing to improve performance globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory; return globalProperties; } diff --git a/src/Cli/dotnet/Commands/Run/RunCommand.cs b/src/Cli/dotnet/Commands/Run/RunCommand.cs index 33ec7b5e3219..fb58a107547d 100644 --- a/src/Cli/dotnet/Commands/Run/RunCommand.cs +++ b/src/Cli/dotnet/Commands/Run/RunCommand.cs @@ -824,11 +824,11 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting { Debug.Assert(ProjectFileFullPath != null); var projectIdentifier = RunTelemetry.GetProjectBasedIdentifier(ProjectFileFullPath, GetRepositoryRoot(), Sha256Hasher.Hash); - + // Get package and project reference counts for project-based apps int packageReferenceCount = 0; int projectReferenceCount = 0; - + // Try to get project information for telemetry if we built the project if (ShouldBuild) { @@ -837,10 +837,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting var globalProperties = MSBuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary(StringComparer.OrdinalIgnoreCase); globalProperties[Constants.EnableDefaultItems] = "false"; globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory; - + using var collection = new ProjectCollection(globalProperties: globalProperties); var project = collection.LoadProject(ProjectFileFullPath).CreateProjectInstance(); - + packageReferenceCount = RunTelemetry.CountPackageReferences(project); projectReferenceCount = RunTelemetry.CountProjectReferences(project); } @@ -869,10 +869,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting { try { - var currentDir = ProjectFileFullPath != null + var currentDir = ProjectFileFullPath != null ? Path.GetDirectoryName(ProjectFileFullPath) : Directory.GetCurrentDirectory(); - + while (currentDir != null) { if (Directory.Exists(Path.Combine(currentDir, ".git"))) @@ -886,7 +886,7 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting { // Ignore errors when trying to find repo root } - + return null; } }