You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[master] Implemented option to preserve the destination folder for File System publishes when Delete existing files option is selected (#15494)
* [master] Implemented option to preserve the destination folder for File System publishes when Delete existing files option is selected
Currently when the File System publish goes to delete the existing files, it also deletes and recreates the target folder. This can have unwarranted side effects, one such being that ACL's on the target folder are removed, and reset based on how the new folder is created (typically just inheriting permissions from the next parent folder). When publishing directly to a web server in this way, any folder permissions that were directly on the folder are lost, and can cause issues for developers who are unaware of this behavior and are attempting to configure permissions for IIS and the web server (an already tricky task). I'm sure there are other scenarios where deleting the target folder is not desired.
By providing an opt-in option to preserve the destination folder, this issue can be bypassed, yet users can still take advantage of the cleanup to remove older website files that may be outdated or defunct inside of the destination.
This option should not affect older publish profiles if they do not have this setting, as I'm hopeful it would default to false in such cases.
For the UI in Visual Studio for configuration, a new checkbox option could be introduced below the "Delete existing files" checkbox. This new option could say "Preserve destination folder" and would be unchecked and disabled until "Delete existing files" is checked, then giving users the option to check it.
* Corrected logic on PreserveDestinationFolder conditional
Based on the MSBuild Conditions documentation, this should have been != 'true' in order to truly support backwards compatibility.
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions?view=vs-2019
Excerpt:
In MSBuild project files, there's no true Boolean type. Boolean data is represented in properties that might be empty or set to any value. Therefore, '$(Prop)' == 'true' means "if Prop is true," but '$(Prop)' != 'false' means "if Prop is true or unset or set to something else."
0 commit comments