Skip to content

Commit 9220ac7

Browse files
authored
Don't strip default items from build-related Targets when building runnable apps (#50942)
1 parent 9418427 commit 9220ac7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ internal static class CommonRunHelpers
1717
public static Dictionary<string, string> GetGlobalPropertiesFromArgs(MSBuildArgs msbuildArgs)
1818
{
1919
var globalProperties = msbuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
20-
globalProperties[Constants.EnableDefaultItems] = "false"; // Disable default item globbing to improve performance
2120
globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory;
2221
return globalProperties;
2322
}

src/Cli/dotnet/Commands/Run/RunCommand.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -824,11 +824,11 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
824824
{
825825
Debug.Assert(ProjectFileFullPath != null);
826826
var projectIdentifier = RunTelemetry.GetProjectBasedIdentifier(ProjectFileFullPath, GetRepositoryRoot(), Sha256Hasher.Hash);
827-
827+
828828
// Get package and project reference counts for project-based apps
829829
int packageReferenceCount = 0;
830830
int projectReferenceCount = 0;
831-
831+
832832
// Try to get project information for telemetry if we built the project
833833
if (ShouldBuild)
834834
{
@@ -837,10 +837,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
837837
var globalProperties = MSBuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
838838
globalProperties[Constants.EnableDefaultItems] = "false";
839839
globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory;
840-
840+
841841
using var collection = new ProjectCollection(globalProperties: globalProperties);
842842
var project = collection.LoadProject(ProjectFileFullPath).CreateProjectInstance();
843-
843+
844844
packageReferenceCount = RunTelemetry.CountPackageReferences(project);
845845
projectReferenceCount = RunTelemetry.CountProjectReferences(project);
846846
}
@@ -869,10 +869,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
869869
{
870870
try
871871
{
872-
var currentDir = ProjectFileFullPath != null
872+
var currentDir = ProjectFileFullPath != null
873873
? Path.GetDirectoryName(ProjectFileFullPath)
874874
: Directory.GetCurrentDirectory();
875-
875+
876876
while (currentDir != null)
877877
{
878878
if (Directory.Exists(Path.Combine(currentDir, ".git")))
@@ -886,7 +886,7 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
886886
{
887887
// Ignore errors when trying to find repo root
888888
}
889-
889+
890890
return null;
891891
}
892892
}

0 commit comments

Comments
 (0)