mercredi 4 janvier 2017

How to exclude APP_DATA directory from publishing using custom target "PublishToFileSystem"

I am using a custom target for publishing my web site to a local folder.

The target (found here) looks like:

<Target Name="PublishToFileSystem"
        DependsOnTargets="PipelinePreDeployCopyAllFilesToOneFolder">
    <Error Condition="'$(PublishDestination)'==''"
           Text="The PublishDestination property must be set to the intended publishing destination." />
    <MakeDir Condition="!Exists($(PublishDestination))"
             Directories="$(PublishDestination)" />

    <ItemGroup>
        <PublishFiles Include="$(_PackageTempDir)\**\*.*" />
    </ItemGroup>

    <Copy SourceFiles="@(PublishFiles)"
          DestinationFiles="@(PublishFiles->'$(PublishDestination)\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="True" />
</Target>

The corresponding msbuild command looks like:

msbuild projectfile.csproj /p:DeployOnBuild=true /p:VisualStudioVersion=14.0 /p:configuration=Release /p:PublishDestination=C:\inetpub\wwwroot\WebSite /T:PublishToFileSystem

That works fine so far. However, I would like to exclude the APP_DATA directory from publishing.

So, is there a way to exclude the APP_DATA directory from publishing? Maybe by excluding it from the file set defined with <PublishFiles Include="$(_PackageTempDir)\**\*.*" />?

Aucun commentaire:

Enregistrer un commentaire