Skip to content
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

[ClickOnce] Update how ClickOnce chooses to publish items from the None group and… #9299

Merged
1 commit merged into from
Oct 13, 2023

Conversation

sujitnayak
Copy link
Contributor

@sujitnayak sujitnayak commented Oct 2, 2023

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

  1. 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.

  2. 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

  1. 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.

  2. 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

@@ -5001,7 +5009,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<Target
Name="_GetCopyToOutputDirectoryItemsFromTransitiveProjectReferences"
DependsOnTargets="_PopulateCommonStateForGetCopyToOutputDirectoryItems;_AddOutputPathToGlobalPropertiesToRemove"
Returns="@(_TransitiveItemsToCopyToOutputDirectory)">
Returns="@(_CopyToOutputDirectoryTransitiveItems)">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am changing the name from _TransitiveItemsToCopyToOutputDirectory to _CopyToOutputDirectoryTransitiveItems b/c otherwise _TransitiveItemsToCopyToOutputDirectory items are duplicated. They get added in this target and the caller then adds the returned items into the same item group.

@AR-May AR-May requested a review from rokonec October 3, 2023 13:33
@rainersigwald rainersigwald changed the base branch from main to vs17.8 October 3, 2023 16:44
… content items from reference project to match thebehavior in VS tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants