[ClickOnce] Update how ClickOnce chooses to publish items from the None group and… #9299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes AB#1889893
Summary
Respect publish profile for items copied from transitive project references in ClickOnce.
Customer Impact
ClickOnce publish includes additional files irrespective of publish profile for .NET 5+ projects.
Regression?
Yes, new files are unconditionally published w.r.t. 17.7.
Testing
Validated the specific scenarios with sample Forms projects.Regression testing by CTI team.
Risk
Medium-low. The majority of the change is in ClickOnce-specific targets, but there's an item-name change that affects all projects. This to a “private” (initial-underscore-named) item and the change shouldn’t be observable outside the targets in question (the original item is still populated, just at a slightly later time).
Context
#9211
#9209
Above PRs added handling for ClickOnce publishing of items from the None group and content items from P2P references. However, it is publishing these items by default w/o checking if they have been opted in for publishing in the ClickOnce profile created in VS. Also the new behavior should only be applicable for apps targeting .NET>=5 and apps targeting .NET FX 4.X should not include these items for publishing at all.
The change does not consider the MSBuildCopyContentTransitive property which decides how transitive content is computed. Depending on the value of MSBuildCopyContentTransitive, the _RecursiveTargetForContentCopying property is set to the target that will compute the transitive content.
Changes Made
Items from the None group and content items from from P2P references that need to be published is now determined based on their presence in the PublishFiles collection and the extension of the files. This matches the logic used on the tooling side in VS. When items are opted into for publishing, they get added to the PublishFiles collection. DLL/EXE files are published by default.
To exclude these items from being considered for ClickOnce publish, the PublishProcol property is also being checked. This property is not set during publish of .NET FX 4.X projects.
ClickOnce target is taking dependency on target set in the _RecursiveTargetForContentCopying property instead of GetCopyToOutputDirectoryItems directly. Setting of DeploymentComputeClickOnceManifestInfoDependsOn property is moved to a later point after the _RecursiveTargetForContentCopying value has been set.
Testing
Testing done with Forms apps with content items specific to the scenario described.
CTI has covered regression testing with these changes.
Notes