I am trying to create a deployment package in Visual Web Developer Express 2010 that sets the ACL for a subfolder on a deployed website. I used the following information http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/
This is my test:
Create a new empty ASP.NET application (WebApplication2 in this example)
In the advanced compilation options, change the target version of the .NET Framework to 3.5
Create a new folder (Config in this example) and add any file inside the folder
Create a new file called WebApplication2.wpp.targets, with this content
<?xml version="1.0" encoding="utf-8" ?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <IncludeCustomACLs>TRUE</IncludeCustomACLs> <AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''"> $(AfterAddIisSettingAndFileContentsToSourceManifest); SetCustomACLs; </AfterAddIisSettingAndFileContentsToSourceManifest> </PropertyGroup> <Target Name="SetCustomACLs" Condition="'$(IncludeCustomACLs)'=='TRUE'"> <Message Text="Adding Custom ACls" /> <ItemGroup> <MsDeploySourceManifest Include="setAcl" Condition="$(IncludeSetAclProviderOnDestination)"> <setAclUser>anonymousAuthenticationUser</setAclUser> <path>$(_MSDeployDirPath_FullPath)</path> <setAclAccess>Read,Write</setAclAccess> <setAclResourceType>Directory</setAclResourceType> <AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings> </MsDeploySourceManifest> </ItemGroup> </Target> </Project>
I run from the command line and everything works fine:
------------------------------------------------------- Start executing msdeploy.exe ------------------------------------------------------- "C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest :auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink: ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml" Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy). Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy). Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy). Número total de cambios: 3 (0 agregados, 0 eliminados, 3 actualizados, 0 parámet ros cambiados, 0 bytes copiados)
Now, to set permissions for the Config folder, I change the next line and rebuild the deployment package.
<path>$(_MSDeployDirPath_FullPath)/Config</path>
I get the following error:
------------------------------------------------------- Start executing msdeploy.exe ------------------------------------------------------- "C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest :auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink: ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml" Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy). Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy). Info: Actualizando setAcl (C:\Temp\WebApplication2\WebApplication2\obj\Debug\Pac kage\PackageTmp/Config). Error: Se debe especificar un valor para 'setAclUser' cuando se usa el proveedor 'setAcl' con una ruta de acceso física. Recuento de errores: 1.
In English, he says: “Error: the value“ setAclUser ”must be specified when using“ setAcl provider with a physical path. ”Note that the third setAcl has been changed to the physical path where the deployment package is located.
Then I tried to change it as follows:
<AdditionalProviderSettings>setAclUser;setAclResourceType;setAclAccess</AdditionalProviderSettings>
But the error remains. If I run the deployment package with the "/ t" switch, it does not throw an error, although it still shows the physical path. I can hardcode the IIS path and change the line as follows:
<path>Default Web Site/WebApplication2_deploy/Config</path>
It works great. However, I would not want to do this, since the installation path needs to be parameterized.
Changing the backslassh path does not matter:
<path>Default Web Site/WebApplication2_deploy\Config</path>
Any help would be greatly appreciated. Thanks