Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:55:36+00:00 2026-06-12T17:55:36+00:00

I have a wcf application hosted in iis that i am trying to package

  • 0

I have a wcf application hosted in iis that i am trying to package using webdeploy. Everything works great with the visual studio tools, but i need to also create a logs folder and set permissions on it. For this i created a ProjectName.wpp.target file in my web project.
The file looks like this

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="CreateLogsDirectory" AfterTargets="AddIisSettingAndFileContentsToSourceManifest">   
    <!-- This must be declared inside of a target because the property 
    $(_MSDeployDirPath_FullPath) will not be defined at that time. -->
    <ItemGroup>
      <MsDeploySourceManifest Include="dirPath">
        <Path>$(_MSDeployDirPath_FullPath)\logs</Path>
        <enableRule>DoNotDeleteRule</enableRule>
      </MsDeploySourceManifest>
    </ItemGroup>
  </Target>

  <Target Name="DeclareCustomParameters" AfterTargets="AddIisAndContentDeclareParametersItems">
    <!-- This must be declared inside of a target because the property 
    $(_EscapeRegEx_MSDeployDirPath) will not be defined at that time. -->
    <ItemGroup>
      <MsDeployDeclareParameters Include="LogsDirectoryPath">
        <Kind>ProviderPath</Kind>
        <Scope>dirPath</Scope>
        <Match>^$(_EscapeRegEx_MSDeployDirPath)\\logs$</Match>
        <Value>$(_DestinationContentPath)/log</Value>
        <ExcludeFromSetParameter>True</ExcludeFromSetParameter>
      </MsDeployDeclareParameters>
    </ItemGroup>
  </Target>
</Project>

i can see that dirPath provider is added to the sourcemanifest file, but when i deploy the package it tries to create the source file path. Essentially the LogsDirectoryPAth item is not replacing the path. can someone point out what i need to do ? thanks !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:55:37+00:00Added an answer on June 12, 2026 at 5:55 pm

    Considering your additional directory is inside your web application, it’s not really necessary to include another dirPath provider and doing so would only lead to more headaches (additional parameter declarations, etc).

    Here are some helpers I use to help with this kind of thing. Your application specific values can be declared in your wpp.targets file:

    <!-- Items specific to your application (these should be in your wpp.targets) -->
    <ItemGroup>
      <SkipDeleteFiles Include="logs" />
    
      <EmptyDirectoriesToDeploy Include="logs" />
    
      <AdditionalAcls Include="logs">
        <AclAccess>Write</AclAccess>
      </AdditionalAcls>
    </ItemGroup>
    

    And the following convention-based definitions can be either put in you wpp.targets or in a common targets file that can be imported into your wpp.targets:

    <!-- 
      Empty directories
    -->
    
    <PropertyGroup>
      <BeforeAddContentPathToSourceManifest>
        $(BeforeAddContentPathToSourceManifest);
        CreateEmptyDirectories;
      </BeforeAddContentPathToSourceManifest>
    </PropertyGroup>
    
    <Target Name="CreateEmptyDirectories">
      <MakeDir Directories="$(_MSDeployDirPath_FullPath)\%(EmptyDirectoriesToDeploy.Identity)" 
               Condition="'@(EmptyDirectoriesToDeploy)' != ''" />
    </Target>
    
    <!-- 
      Additional ACLs 
    -->
    
    <ItemDefinitionGroup>
      <AdditionalAcls>
        <AclAccess>Write</AclAccess>
        <ResourceType>Directory</ResourceType>
      </AdditionalAcls>
    </ItemDefinitionGroup>
    
    <PropertyGroup>
      <AfterAddIisSettingAndFileContentsToSourceManifest>
        $(AfterAddIisSettingAndFileContentsToSourceManifest);
        AddAdditionalAclsToSourceManifest;
      </AfterAddIisSettingAndFileContentsToSourceManifest>
      <AfterAddIisAndContentDeclareParametersItems>
        $(AfterAddIisAndContentDeclareParametersItems);
        AddAdditionalAclsDeclareParameterItems
      </AfterAddIisAndContentDeclareParametersItems>
    </PropertyGroup>
    
    <Target Name="AddAdditionalAclsToSourceManifest">
      <ItemGroup Condition="'@(AdditionalAcls)' != ''">
        <MsDeploySourceManifest Include="setAcl">
          <Path>$(_MSDeployDirPath_FullPath)\%(AdditionalAcls.Identity)</Path>
          <setAclResourceType Condition="'%(AdditionalAcls.ResourceType)' != ''">%(AdditionalAcls.ResourceType)</setAclResourceType>
          <setAclAccess>%(AdditionalAcls.AclAccess)</setAclAccess>
          <AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
        </MsDeploySourceManifest>
      </ItemGroup>
    </Target>
    
    <Target Name="AddAdditionalAclsDeclareParameterItems">
      <ItemGroup Condition="'@(AdditionalAcls)' != ''">
        <MsDeployDeclareParameters Include="Add %(AdditionalAcls.AclAccess) permission to %(AdditionalAcls.Identity) Folder">
          <Kind>ProviderPath</Kind>
          <Scope>setAcl</Scope>
          <Match>^$(_EscapeRegEx_MSDeployDirPath)\\@(AdditionalAcls)$</Match>
          <Description>Add %(AdditionalAcls.AclAccess) permission to %(AdditionalAcls.Identity) Folder</Description>
          <DefaultValue>{$(_MsDeployParameterNameForContentPath)}/@(AdditionalAcls)</DefaultValue>
          <DestinationContentPath>$(_DestinationContentPath)/@(AdditionalAcls)</DestinationContentPath>
          <Tags>Hidden</Tags>
          <ExcludeFromSetParameter>True</ExcludeFromSetParameter>
          <Priority>$(VsSetAclPriority)</Priority>
        </MsDeployDeclareParameters>
      </ItemGroup>
    </Target>
    
    <!-- 
      Skip delete files and directories
    -->
    
    <PropertyGroup>
      <ImportPublishingParameterValuesDependsOn>
        $(ImportPublishingParameterValuesDependsOn);
        AddSkipDirectives;
      </ImportPublishingParameterValuesDependsOn>
    </PropertyGroup>
    
    <ItemGroup>
      <SkipDeleteItems Include="@(SkipDeleteFiles)" 
                       Condition="'@(SkipDeleteFiles)' != ''">
        <Provider>filePath</Provider>
      </SkipDeleteItems>
    
      <SkipDeleteItems Include="@(SkipDeleteDirectories)" 
                       Condition="'@(SkipDeleteDirectories)' != ''">
        <Provider>dirPath</Provider>
      </SkipDeleteItems>
    </ItemGroup>
    
    <!-- Uses MSBuild trickery to add an escaped version of the skip path to as 
         "EscapedPath" metadata -->
    <Target Name="AddRegexEscapedPathMetadata" Outputs="%(SkipDeleteItems.EscapedPath)">
      <EscapeTextForRegularExpressions Text="%(SkipDeleteItems.Identity)">
        <Output TaskParameter="Result" 
                PropertyName="_Temp_EscapeRegEx_SkipDeleteItemPath" />
      </EscapeTextForRegularExpressions>
    
      <ItemGroup>
        <SkipDeleteItems Condition="'%(SkipDeleteItems.Identity)' == '%(Identity)'" >
          <EscapedPath>$(_Temp_EscapeRegEx_SkipDeleteItemPath)</EscapedPath>
        </SkipDeleteItems>
      </ItemGroup>
    
      <PropertyGroup>
        <!-- Clear value -->
        <_Temp_EscapeRegEx_SkipDeleteItemPath></_Temp_EscapeRegEx_SkipDeleteItemPath>
      </PropertyGroup>
    
    </Target>
    
    <Target Name="AddSkipDirectives" DependsOnTargets="AddRegexEscapedPathMetadata">
    
      <ItemGroup>
        <MsDeploySkipRules Include="%(SkipDeleteItems.Identity)">
          <SkipAction>Delete</SkipAction>
          <ObjectName>%(SkipDeleteItems.Provider)</ObjectName>
          <AbsolutePath>%(SkipDeleteItems.EscapedPath)</AbsolutePath>
        </MsDeploySkipRules>
      </ItemGroup>
    
    </Target>
    

    NB If you go to the extra effort to separate your packaging process from your deployment process, then technically your SkipDeleteFiles should be in your pubxml rather than your wpp.targets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wcf REST application hosted on IIS. Everything works fine, GET and
I have a application that's making calls against some WCF services I have hosted
I have a WCF application that is using NetTcpBinding . I want to invoke
I have IIS-Hosted WCF application and services. I want to automate the process to
We have a WCF service that we recently switched from self-hosting to IIS-hosted. It
I have a WCF service hosted in IIS 7 using HTTPS. When I browse
We have a couple of WCF services hosted in an asp.net application on IIS.
I have a WPF application which talks to a WCF service hosted in IIS.
I have a WCF application that normally runs in IIS (for my testing and
I have a WCF Service, hosted inside of IIS, using NHibernate for data access.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.