title: setting ACLs for subfolders using Web Deploy package
body: <p>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> </p>
  
  <p>This is my test:</p>
  
  <p>Create a new blank ASP.NET Application (WebApplication2 in this example)</p>
  
  <p>In advanced compilation options, change .NET Framework target version to 3.5</p>
  
  <p>Create a new folder (Config in this example) and add any file inside the folder</p>
  
  <p>Create a new file called WebApplication2.wpp.targets, with this content</p>
  
  <pre><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;
  </code></pre>
  
  <p>I execute from the command line and everything works fine:</p>
  
  <pre><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)
  </code></pre>
  
  <p>Now, to set the permissions for the Config folder, I change the following line and rebuild the deployment package.</p>
  
  <pre><code>&lt;path&gt;$(_MSDeployDirPath_FullPath)/Config&lt;/path&gt;
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><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.
  </code></pre>
  
  <p>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.</p>
  
  <p>I then tried to modify it this way:</p>
  
  <pre><code>&lt;AdditionalProviderSettings&gt;setAclUser;setAclResourceType;setAclAccess&lt;/AdditionalProviderSettings&gt;
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>&lt;path&gt;Default Web Site/WebApplication2_deploy/Config&lt;/path&gt;
  </code></pre>
  
  <p>It works fine. However, I wouldn’t like to do that, since the installation path need to be parameterized.</p>
  
  <p>Changing the path to a backslassh makes no difference:</p>
  
  <pre><code>&lt;path&gt;Default Web Site/WebApplication2_deploy\Config&lt;/path&gt;
  </code></pre>
  
  <p>Any help would be appreciated.
  Thanks</p>