Prevent Visual Studio 2010/12 and Web Deploy From Changing ACLs
Posted by Phil (Netcetera) on 26 February 2013 02:52 PM
|
|
Microsoft Visual Studio and Web Matrix both support a new way to publish your website, using Microsoft's Web Deploy. For Visual Studio 2010: There are project-level properties for everything we do in VS to publish or create a deployment package. To disable setting ACLs, you can do either of these: 1) Edit the .csproj file and set <IncludeSetAclProviderOnDestination>False</IncludeSetAclProviderOnDestination> 2) msbuild.exe myproject.csproj /p:IncludeSetAclProviderOnDestination=False
Secondly you need to determine what your configuration and platform are for the project. To do that, right click your project in Visual Studio 2010 and select Package/Publish Settings. Look at the Configuration: and Platform: drop downs. In my example below they are set to Release and Any CPU. Look for the following line in the project file:
<propertygroup condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></propertygroup>
Scroll down to the closing tag of:
</propertygroup>
Add a new line right above it and put the following there:
<includesetaclproviderondestination>False</includesetaclproviderondestination>
Save your project file. The next time you publish your project, it won't make any ACL changes on the remote server and all your existing NTFS permissions will remain intact.
For Visual Studio 2012
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
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
| |
|
I just checked