views:

20

answers:

1

I'm using a Web Deployment Project 2008 to build my web application. I'd like to exclude the contents of several folders from the build but keep the blank directory itself. However, if I do this

<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\ImageCache\**\*.*" />

it will exclude the ImageCache directory itself. So how do I keep the directory? Thanks in advance?

A: 

I'm afraid you must do this in two lines :

<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\ImageCache\**\*.*" />
<IncludeFromBuild Include="$(SourceWebPhysicalPath)\ImageCache\" />

But that could not work because The "Copy" task does not support copying directories. Thus, what I suggest is that you exclude the files like you did and create an empty directory in the AfterMerge target :

<ItemGroup>
  <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\ImageCache\**\*.*" />
<ItemGroup>

<...>

<Target Name="AfterMerge">
  <MakeDir Directories="$(SourceWebPhysicalPath)\ImageCache" />
</Target>
Benjamin Baumann
I've marked this as the right answer as I did eventually do it in two steps. ExcludeFromBuild was the first, but the second was calling MakeDir in the AfterBuild target else the directory wasn't created in the place the deployed code was copied to by the WDP. <MakeDir Directories="..\..\ReleaseToLive\ImageCache" />
Hmobius