-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Removing duplicate files from publish output #14020
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
Conversation
src/Tasks/Microsoft.NET.Build.Tasks/CheckForDuplicateItemMetadata.cs
Outdated
Show resolved
Hide resolved
@dsplaisted this is #12085 retargeted for 6, do you mind taking a look? The outstanding question there was which item groups should have presendence when copying to publish output, specifically between |
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.
It looks like in some cases, this PR is generating an error when there are duplicate items, while in others it is just automatically removing the duplicates. I think the correct behavior would be only to automatically remove duplicates if they are coming from the same source files (ie the source and destination are both the same), or if we can run them through the conflict resolution process which will look at the file versions to figure out which file is newer, and use that one.
If we can't do real conflict resolution, then I think we should error in all cases where there are conflicts (and the source is different). That would be a breaking change though, so really it would be ideal if we can do conflict resolution.
Separately, it would be helpful to add comments to the logic dealing with duplicates explaining what is in each item group (basically what is described here: #12085 (comment)).
src/Tasks/Microsoft.NET.Build.Tasks/CheckForDuplicateItemMetadata.cs
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ConflictResolution.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ConflictResolution.targets
Outdated
Show resolved
Hide resolved
@dsplaisted The error I'm adding here is not one we expect to run into, as the rest of the logic in this PR removes duplicate writes in all cases I'm aware of (notice we don't expect to see this error in the tests). We run into this error without the filtering logic added in this PR, and it will be raised if there are any other cases of double writes on publish that we aren't aware of right now.
This is what this PR attempts to do. The error I'm adding covers cases where there are conflicts, but we aren't seeing it thrown in any test cases because of the conflict resolution logic added here.
Sounds good, will do! |
@dsplaisted I've added logic to resolve conflicts between duplicates, do you mind taking another look? |
@sfoslund Per our discussion, can you see if the existing |
@dsplaisted The existing |
Ping @dsplaisted do you have any feedback here? |
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.
This is good to merge as is, but you can also consider doing what I've filed in #14422
Reviving #12085
Related bugs: #10850, #3904, and #11959