Wednesday, 09 December, 2020
DevOps Tip - Prevent MSDeploy Overwriting Umbraco File Permissions
How to prevent Visual Studio's MSDeploy changing the file permissions on the web-server when you publish updates.
When publishing an Umbraco or ASP.NET application Visual Studio's MSDeploy will change the file permissions on the hosting server by default.
By default, Visual Studio sets read permissions on the root folder of the destination site and write permissions on the App_Data folder.
For Umbraco websites this is not desired behaviour; see https://our.umbraco.com/documentation/Getting-Started/Setup/Server-Setup/permissions.
You can prevent Visual Studio and MSDeploy from amending file permissions for your project and all it's publish profiles by creating a wpp.targets file and adding the following entry:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination> </PropertyGroup>
</Project>
This may require a Visual Studio restart to take effect and will only work with Web Project style applications (those having a .csproj file); read https://docs.microsoft.com/en-us/previous-versions/aspnet/ff398069(v=vs.110 for more information.
Want to Say Thanks?
Why not buy me a coffee at https://www.paypal.me/justaguycoding?