setting ACLs for subfolders using Web Deploy package

admin

Administrator
Staff member
I’m trying to build a Deployment Package in Visual Web Developer Express 2010 which sets the ACL for a subfolder of the deployed website. I used the following information <a href="http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/" rel="nofollow">http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/</a>

This is my test:

Create a new blank ASP.NET Application (WebApplication2 in this example)

In advanced compilation options, change .NET Framework target version 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

Code:
&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;PropertyGroup&gt;
        &lt;!-- Extends the AfterAddIisSettingAndFileContentsToSourceManifest action do also set ACLs --&gt;
        &lt;IncludeCustomACLs&gt;TRUE&lt;/IncludeCustomACLs&gt;
        &lt;AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''"&gt;
            $(AfterAddIisSettingAndFileContentsToSourceManifest);
            SetCustomACLs;
        &lt;/AfterAddIisSettingAndFileContentsToSourceManifest&gt;
    &lt;/PropertyGroup&gt;
    &lt;Target Name="SetCustomACLs" Condition="'$(IncludeCustomACLs)'=='TRUE'"&gt;
        &lt;Message Text="Adding Custom ACls" /&gt;
        &lt;ItemGroup&gt;
            &lt;MsDeploySourceManifest Include="setAcl" Condition="$(IncludeSetAclProviderOnDestination)"&gt;
                &lt;setAclUser&gt;anonymousAuthenticationUser&lt;/setAclUser&gt;
                &lt;path&gt;$(_MSDeployDirPath_FullPath)&lt;/path&gt;
                &lt;setAclAccess&gt;Read,Write&lt;/setAclAccess&gt;
                &lt;setAclResourceType&gt;Directory&lt;/setAclResourceType&gt;
                &lt;AdditionalProviderSettings&gt;setAclResourceType;setAclAccess&lt;/AdditionalProviderSettings&gt;
            &lt;/MsDeploySourceManifest&gt;
        &lt;/ItemGroup&gt;
    &lt;/Target&gt;
&lt;/Project&gt;

I execute from the command line and everything works fine:

Code:
-------------------------------------------------------
 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 the permissions for the Config folder, I change the following line and rebuild the deployment package.

Code:
&lt;path&gt;$(_MSDeployDirPath_FullPath)/Config&lt;/path&gt;

I get the following error:

Code:
-------------------------------------------------------
 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 it says: “Error: a value for ‘setAclUser’ must be specified when using the ‘setAcl’ provider with a physical path". Notice the third setAcl was changed to the physical path where the deployment package is located.

I then tried to modify it this way:

Code:
&lt;AdditionalProviderSettings&gt;setAclUser;setAclResourceType;setAclAccess&lt;/AdditionalProviderSettings&gt;

But the error remains.
If I execute the deployment package with the “/t” switch, it does not throw the error, although it still shows the physical path.
I can hardcode the IIS path and change the line like this:

Code:
&lt;path&gt;Default Web Site/WebApplication2_deploy/Config&lt;/path&gt;

It works fine. However, I wouldn’t like to do that, since the installation path need to be parameterized.

Changing the path to a backslassh makes no difference:

Code:
&lt;path&gt;Default Web Site/WebApplication2_deploy\Config&lt;/path&gt;

Any help would be appreciated.
Thanks