views:

1084

answers:

2

I've added a Web Deployment Project to my solution to create a clean deployment of my web application. This works mostly as expected... i.e. builds the source & then copies the files to be deployed to a /Release folder (and excludes things like source files and my .svn folders, etc).

But now I want to explicitly exclude some other files (for the sake of simplicity lets just say one file called somefile.txt). So, I add an item group to the wdproj file as follows:

<ItemGroup>
    <ExcludeFromBuild Include="somefile.txt" />
</ItemGroup>

This does indeed exclude the specific file as requested, but now the files excluded by default are no longer excluded. Specifically, now all my svn files are in the Release folder & there's also a Source folder at the same level with all the source in it.

Basically, it seems that defining the ExcludeFromBuild item group is overwriting some set of built-in defaults, rather than adding to them.

Not exactly a show stopper, but not ideal... So, does anyone know how to simply add a file to the default ExcludeFromBuild group? Or is it a case of using the defaults Vs. excluding everything by hand Vs. deleting the files you don't after a default build?

A: 

I'm not sure if this helps, but the command has an Exclude property, you could override the target that is copying the files and use to include/exclude what you need.

Adam Fyles
Thanks for the help, but I ended up doing it by hand using ExcludeFromBuild...
Alconja
+15  A: 

Well for anyone who comes looking, I thought I should answer my own question... I didn't find the exact solution I was looking for, so I just added everything I needed excluded manually to the ExcludeFromBuild ItemGroup (to mimic what the default options seemed to do & then also exclude my specific file). My ExcludeFromBuild list ended up looking like this:

<ItemGroup>
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\somefile.txt" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\obj\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.csproj" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.scc" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.user" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.vspscc" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.log" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.svclog" />
</ItemGroup>

Basically excludes all log files, user/project files, svn files, source safe files, etc plus the custom files I wanted to ignore in the first place.

Alconja
Thanks for that!
Iain M Norman