Disclaimer: I know that I can retain folder permissions if i check the "Leave extra files on destination" checkbox but I don't want to do that.
That said, is there any way to have one-click web publishing in Visual Studio 2010 retain the permissions of a folder on the remote server?
Specifically, I want the app pool account to have modify permissions to the App_Data folder, but the permissions always get reset during the publish process.
In Windows Explorer, right-click the folder you want to share, and then click Properties. On the Sharing tab, click Advanced Sharing. In User Account Control, click Continue to accept the prompt that Windows needs your permission to perform the action. In the Advanced Sharing dialog box, check Share this folder.
By default we will call the Web Deploy SetAcl provider on the App_Data folder, this behavior is controlled by an MSBuild property, IncludeSetAclProviderOnDestination. The default value for this property is true in %ProgramFiles32%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets. If you want to prevent the SetAcl provider from being called you can just set this property to false when publishing. In order to do this follow these steps.
{ProjectName}.wpp.targets
<?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>
Inside of this file you can see that I'm declaring that property and setting it's value to False. After you have this file it will automatically be picked up by our publishing process, both from Visual Studio as well as any publish operations from the command line.
Can you try that out and let me know if you have further issues?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With