From 4f5a7b08965ab64cfc603a4a33f26781a3a72d06 Mon Sep 17 00:00:00 2001 From: --get Date: Tue, 16 Sep 2025 18:46:41 -0500 Subject: [PATCH 1/2] address Daniel's feedback --- .../targets/Microsoft.NET.PackTool.targets | 41 ++++++++----------- .../targets/Microsoft.NET.Sdk.props | 1 - ...oBuildAnAppWithoutTransitiveProjectRefs.cs | 6 +-- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets index 6566bebb20ef..58ccbff7cbe7 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets @@ -62,32 +62,10 @@ NOTE: This file is imported from the following contexts, so be aware when writin <_InnerToolsPublishAot>false <_InnerToolsPublishAot Condition="$(_HasRIDSpecificTools) and '$(PublishAot)' == 'true'">true - - <_IsImplicitRestore>false - <_IsImplicitRestore Condition="'$(MSBuildIsRestoring)' == 'true'">true - <_IsPacking Condition="'$(_IsPacking)' == ''">false - - - false - false - false - false - false - false - <_ToolPackageShouldIncludeImplementation Condition=" '$(_ToolPackageShouldIncludeImplementation)' == '' And '$(PackAsTool)' == 'true' And - ('$(_UserSpecifiedToolPackageRids)' == '' + (!$(_HasRIDSpecificTools) or '$(RuntimeIdentifier)' != '')">true <_ToolPackageShouldIncludeImplementation Condition="'$(_ToolPackageShouldIncludeImplementation)' == ''">false @@ -112,6 +90,23 @@ NOTE: This file is imported from the following contexts, so be aware when writin Because this target is inherently TFM-specific, and NuGet handles invoking this target once per TFM as part of the packaging process. --> $(TargetsForTfmSpecificContentInPackage);PackTool + + + + + false + false + false + false + false + false + + false false false diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs index 57f2fc797cdc..ade6e0463c28 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs @@ -29,17 +29,13 @@ public void It_builds_the_project_successfully_with_static_graph_and_isolation() public void It_cleans_the_project_successfully_with_static_graph_and_isolation() { var (testAsset, outputDirectories) = BuildAppWithTransitiveDependenciesAndTransitiveCompileReference(new[] { "/graph", "/bl:build-{}.binlog" }); - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ? - Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_the_project_successfully_with_static_graph_and_isolation)}.binlog") : - "./msbuild.binlog"; var cleanCommand = new DotnetCommand( Log, "msbuild", Path.Combine(testAsset.TestRoot, "1", "1.csproj"), "/t:clean", - "/graph", - $"/bl:{binlogDestPath}"); + "/graph"); cleanCommand .Execute() From fa76136386b986a52bc56e46b7c0fcc8dfb9a067 Mon Sep 17 00:00:00 2001 From: --get Date: Wed, 17 Sep 2025 20:59:10 -0500 Subject: [PATCH 2/2] revert more ad-hoc binlog creation and upload --- ...eWantToBuildAnAppWithoutTransitiveProjectRefs.cs | 7 +------ .../GivenThatWeWantToPublishASingleFileApp.cs | 7 +------ .../GivenThatWeWantToPublishAToolProject.cs | 8 +------- .../GivenThatWeWantToPublishIncrementally.cs | 13 ++----------- ...nThatWeWantToPackAToolProjectWithPackagedShim.cs | 6 +----- 5 files changed, 6 insertions(+), 35 deletions(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs index ade6e0463c28..8f9b453b47ab 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs @@ -180,13 +180,8 @@ public void It_builds_the_project_successfully_when_RAR_does_not_find_all_refere { var buildCommand = new BuildCommand(testAsset, "1"); buildCommand.WithWorkingDirectory(testAsset.TestRoot); - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ? - Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{callingMethod}.binlog") : - "./msbuild.binlog"; - var buildResult = buildCommand.ExecuteWithoutRestore([..msbuildArguments, $"/bl:{binlogDestPath}"]); - + var buildResult = buildCommand.ExecuteWithoutRestore(msbuildArguments); var outputDirectories = targetFrameworks.ToImmutableDictionary(tf => tf, tf => buildCommand.GetOutputDirectory(tf)); - return (buildResult, outputDirectories); } diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index d8a821397e42..60a0533cc31b 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -853,14 +853,9 @@ public void It_can_disable_cetcompat(bool? cetCompat) testProject.AdditionalProperties.Add("CetCompat", cetCompat.ToString()); } - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ? - Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_can_disable_cetcompat)}_{cetCompat?.ToString() ?? "null"}.binlog") : - "./msbuild.binlog"; - - var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: cetCompat.HasValue ? cetCompat.Value.ToString() : "default"); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute(PublishSingleFile, "/bl:" + binlogDestPath) + publishCommand.Execute(PublishSingleFile) .Should() .Pass(); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProject.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProject.cs index b9bca0e339e7..437e06b0a194 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProject.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProject.cs @@ -51,13 +51,7 @@ public void It_can_publish_selfcontained_and_has_apphost() { var testAsset = SetupTestAsset().SetProjProperty("PublishSelfContained", "true"); var publishCommand = new PublishCommand(testAsset); - - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot ? - Path.Combine(ciOutputRoot, "binlog", $"{nameof(It_can_publish_selfcontained_and_has_apphost)}.binlog") : - "./msbuild.binlog"; - - publishCommand.WithWorkingDirectory(testAsset.Path).Execute($"-bl:{binlogDestPath}"); - + publishCommand.WithWorkingDirectory(testAsset.Path).Execute(); publishCommand.GetOutputDirectory(targetFramework: ToolsetInfo.CurrentTargetFramework, runtimeIdentifier: System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier) .Should().HaveFile("consoledemo" + Constants.ExeSuffix) .And.HaveFile(HostfxrName); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs index c47c60089692..a97964d0d36a 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs @@ -62,14 +62,10 @@ public void It_cleans_between_renames() }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ? - Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_between_renames)}.binlog") : - "./msbuild.binlog"; - // Publish as a single file var publishCommand = new PublishCommand(testAsset); publishCommand - .Execute(@"/p:PublishSingleFile=true", $"-bl:{binlogDestPath}") + .Execute(@"/p:PublishSingleFile=true") .Should() .Pass(); @@ -107,14 +103,9 @@ public void It_cleans_between_single_file_publishes() }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ? - Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_between_single_file_publishes)}.binlog") : - "./msbuild.binlog"; - - var publishCommand = new PublishCommand(testAsset).WithWorkingDirectory(testAsset.Path) as PublishCommand; publishCommand - .Execute(@"/p:PublishSingleFile=true", $"-bl:{binlogDestPath}") + .Execute(@"/p:PublishSingleFile=true") .Should() .Pass(); diff --git a/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs b/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs index 63dbc7a4a518..7e1ff1d2a280 100644 --- a/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs +++ b/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs @@ -262,11 +262,7 @@ public void It_contains_shim_with_no_build(bool multiTarget, string targetFramew buildCommand.Execute().Should().Pass(); var packCommand = new PackCommand(testAsset).WithWorkingDirectory(testAsset.Path) as PackCommand; - var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot ? - Path.Combine(ciOutputRoot, "binlog", $"{nameof(It_contains_shim_with_no_build)}_{multiTarget}_{targetFramework}.binlog") : - "./msbuild.binlog"; - - packCommand.Execute($"/p:NoBuild=true", $"/bl:{binlogDestPath}").Should().Pass(); + packCommand.Execute($"/p:NoBuild=true").Should().Pass(); var nugetPackage = packCommand.GetNuGetPackage(); using (var nupkgReader = new PackageArchiveReader(nugetPackage))