views:

457

answers:

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>
A: 

Are you using a "web deployment project" - if so, you can either include "Primary Output" AND "Content Files" OR specifically include the .master file.

Sohnee
Thanks for your response! I am using Web Deployment Project, yes. How can I set these flags? And does this functionality also allow me to exclude files/directories?
Dan Atkinson
When you first create the Web Deployment project, you normally right-click on the deployment project and select "Add Project Output" - they you choose the project and select both "Primary Output" and "Content Files".
Sohnee
Sohnee, there was no option for this I'm afraid.
Dan Atkinson
+2  A: 

Hi, 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
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
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
A: 

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