-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make packtool targets light up only on pack #50445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/10.0.1xx
Are you sure you want to change the base?
Make packtool targets light up only on pack #50445
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where PackTool.targets were incorrectly modifying properties that affected tool publishing behavior, not just packaging. The fix restructures the targets to ensure tool-specific modifications only activate during pack operations.
Key changes:
- Moves tool-specific property modifications from global scope to pack-specific targets
- Adds
_IsPacking
property to PackCommand and related test framework classes - Updates file-based program support to include
dotnet pack
functionality
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets | Restructures targets to move property modifications into pack-specific scope |
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets | Removes PackAsTool condition from runtime identifier inference |
src/Cli/dotnet/Commands/Pack/PackCommand.cs | Adds file-based program support and refactors command creation |
test/Microsoft.NET.TestFramework/Commands/*.cs | Adds _IsPacking and _IsPublishing properties to test commands |
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Adds comprehensive tests for pack functionality with file-based programs |
test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProject.cs | Adds regression test for normal publish behavior |
eng/Version.Details.xml | Updates Microsoft.Testing.Platform and MSTest package versions |
@@ -51,28 +48,15 @@ NOTE: This file is imported from the following contexts, so be aware when writin | |||
<_UserSpecifiedToolPackageRids Condition="'$(_UserSpecifiedToolPackageRids)' == ''">$(RuntimeIdentifiers)</_UserSpecifiedToolPackageRids> | |||
<_HasRIDSpecificTools Condition=" '$(_UserSpecifiedToolPackageRids)' != '' ">true</_HasRIDSpecificTools> | |||
<_HasRIDSpecificTools Condition="'$(_HasRIDSpecificTools)' == ''">false</_HasRIDSpecificTools> | |||
<!-- unlike all of the other computed properties here, we _do_ want to mutate RuntimeIdentifiers here so that we ensure that the shims are included in restores --> | |||
<RuntimeIdentifiers Condition="'$(PackAsToolShimRuntimeIdentifiers)' != ''">$(_UserSpecifiedToolPackageRids);$(PackAsToolShimRuntimeIdentifiers)</RuntimeIdentifiers> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This property modification is in global scope but the comment on line 51 indicates it should mutate RuntimeIdentifiers. This creates inconsistency with the goal of moving modifications to pack-specific targets. Consider moving this to a pack-specific target if possible.
<RuntimeIdentifiers Condition="'$(PackAsToolShimRuntimeIdentifiers)' != ''">$(_UserSpecifiedToolPackageRids);$(PackAsToolShimRuntimeIdentifiers)</RuntimeIdentifiers> |
Copilot uses AI. Check for mistakes.
Fixes #50435
The PackTool.targets were modifying critical properties of the tool package project that impacted the way the tool would be published, not just packed.
To fix this, I looked at the data dependencies between the various properties and pushed them into a series of Targets that happen early on in tool packaging to ensure that tool projects can be published as normal, and the tool-specific modifications only ever light up on packaging-based Targets