3

We seem to be having an issue when running our deployment project in that, when it compiles, it seems to miss our master pages from the output.

Is there any way to 'force' the project to include .master files, either through editing the .wdproj file, or via another method?

Also, I've been reading up on the MSBuildTasks community project, and have followed some of the sample documentation but this doesn't appear to work. The project won't exclude files that I select, and doesn't seem to do compression either. Has anyone else tried this extension that can provide feedback/guidance?

Many thanks in advance

Update:

I have fixed this by creating an Itemgroup and doing a copy.

<ItemGroup>
  <MasterFiles Include="$(SolutionDir)\MVC\Views\Shared\Templates\**\*.master" />
</ItemGroup>

<Target Name="AfterBuild">
  <Copy SourceFiles="@(MasterFiles)" DestinationFiles="$(OutputPath)\Views\Shared\Templates\%(RecursiveDir)%(Filename)%(Extension)" />
</Target>
Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114

2 Answers2

2

One problem that I've noticed with Web Deployment Projects is that it assumes that your web application has already been built. So you must build it before invoking the .wdproj itself. I'm not sure if this is your problem though.

About excluding files, you'll have to crack open the .wdproj file, which is just an MSBuild file. To exclude files add them to the ExcludeFromBuild item. For instance to make sure that your project file is not included inthe deployment you would add a statement like:

<ItemGroup>
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)*.csproj"/>
    <!-- Below excludes svn folders -->
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)**\.svn\**\*"/>
</ItemGroup>

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

Sayed Ibrahim Hashimi
  • 43,864
  • 17
  • 144
  • 178
  • 1
    Sayed, Thanks for your response. I have found the ExcludeFromBuild flag, but this appears to copy all of our web project over, svn directories and all, and then work on that. Before, it would just compile everything and generate a handful of directories. – Dan Atkinson Jun 19 '09 at 15:37
  • Hi, I just edited the example to demonstrate how to exclude .svn folders. BTW I took these straight from my book there is almost an entire chapter on Web Deployment projects there. – Sayed Ibrahim Hashimi Jun 19 '09 at 17:31
0

I have fixed this by creating an Itemgroup and doing a copy.

<ItemGroup>
  <MasterFiles Include="$(SolutionDir)\MVC\Views\Shared\Templates\**\*.master" />
</ItemGroup>

<Target Name="AfterBuild">
  <Copy SourceFiles="@(MasterFiles)" DestinationFiles="$(OutputPath)\Views\Shared\Templates\%(RecursiveDir)%(Filename)%(Extension)" />
</Target>

Many thanks

Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114