Monday, May 26, 2014

Publish empty folders


If you need to include an empty folder when deploying using MSDeploy (either manually from Visual Studio or calling msdeploy from scripts) you can do that by:

1. create a Web Publishing Pipeline file (.wpp.targets)

   Create a new XML file in the project folder (the same folder that holds the .csproj or .vbproj file) and name it <projectname>.wpp.targets.

2. Add the following

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="">
  <Target Name="MakeEmptyFolders">
    <Message Text="Adding empty folder to hold downloads" />
    <MakeDir Directories="$(_MSDeployDirPath_FullPath)\Survey\responses"/>

In my case I needed an empty folder called ‘responses’ inside an existing ‘Survey’ folder.

The folder will be created no matter which configuration or publishing profile is run.

More info:

No comments: