2

I'm trying to deploy a selection of pages and master pages in modules but I'm encountering the same problem with all of them.

When I try to navigate to a page, I get a File Not Found error (with unfortunately no information in ULS), but when I view the site in Designer, the files are there in the places I expected. In addition, the master pages show up in the Master Pages section of Site Settings, but when I set the master page on my site and navigate to default.aspx, I get file not found errors again.

I can see that the files have been deployed properly, but why are they not being served?

Here's the markup I've got in my module element files:

<Module Name="MyWebPages" Url="SitePages">
  <File Path="MyWebPages\Page1.aspx" Url="Page1.aspx" Type="GhostableInLibrary" />
</Module>

and

<Module Name="MasterPage" List="116" Url="_catalogs/masterpage">
  <File Path="MasterPage\MyMasterPage.master" Url="MyMasterPage.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />
</Module>

Update I've redeployed the pages module, which seems to be working now, but still no luck with the master page.

Update 2 Added the new master page Elements.xml file. The strange thing is that the master page has deployed fine in the past, but I'm now I'm on a new site, it's failing.

Update 3 Added Falak's suggestions

4
  • First things first: Are you sure you're navigating to the correct page? Try launching the page from designer using the "Preview in Browser" ribbon button, or right-click action.
    – Chloraphil
    Commented Jul 12, 2013 at 15:29
  • I've tried navigating from the the designer, get the same error.
    – MorayM
    Commented Jul 12, 2013 at 15:32
  • What do you see if you go to the "MyWebPages" library?
    – Chloraphil
    Commented Jul 12, 2013 at 15:33
  • I've redeployed the web pages module which seems to be working, but no luck with the master pages one. The master page is viewable in /_catalogs/masterpage/Forms/AllItems.aspx, and I can download it, but any page that uses it shows the cannot be found error
    – MorayM
    Commented Jul 12, 2013 at 15:39

3 Answers 3

3

Looks like you are missing the content type property in your element file, and possibly more: http://blogs.msdn.com/b/bobgerman/archive/2011/01/31/packaging-master-pages-and-page-layouts-with-visual-studio-2010.aspx

3
  • 1
    Also, you may need to approve your new master page. See further down the page I linked.
    – Chloraphil
    Commented Jul 12, 2013 at 15:47
  • Yes, I've tried setting the content type in the element file and in the properties dialog on the site, page is set to approved, still no luck...
    – MorayM
    Commented Jul 15, 2013 at 7:55
  • Please update your original post with any changes you made to your elements files.
    – Chloraphil
    Commented Jul 15, 2013 at 12:55
1

Try setting the List attribute to 116 i.e. Master page Gallery. For Master page you don't need a Content type association. Associate your Content Type with relevant page layouts and use fiddler to check the request. See sample below:

For master pages:

      <Module Name="MasterPage" List="116" Url="_catalogs/masterpage" >
        <File Path="MasterPage\MyMasterPage.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" Url="MyMasterPage.master" />         
      </Module>

For the page layouts, set the Url attribute of module to point to Master page gallery and PublishingAssociatedContentType and other properties like this:

<Module Name="PageLayouts" Url="_catalogs/masterpage">
    <File Path="PageLayouts\YourPage.aspx" Url="YourPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="true">
      <Property Name="Title"
                Value="YourPageName" />
      <Property Name="MasterPageDescription"
                Value="YourPageDescription" />
      <Property Name="ContentType"
                Value="YourContentTypeName" />
      <Property Name="PublishingPreviewImage"
                Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLeft.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLeft.png" />
      <Property Name="PublishingAssociatedContentType"
                Value=";#YourContentTypeName;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D00bc6ec9af9289476b99640c668f2c50fc01;#" />
    </File>   
</Module>

Note: the content type id being used is inherited from Article page publishing content type. Happy SharePointing!

3
  • Thanks for the suggestion, but no luck I'm afraid.
    – MorayM
    Commented Jul 15, 2013 at 16:02
  • I'm not sure if you're provisioning your page layouts in a correct way? Can you try my updated code for Page layouts as well? Commented Jul 15, 2013 at 19:02
  • Sorry, maybe I wasn't clear in the update, my page layouts are deploying fine.
    – MorayM
    Commented Jul 16, 2013 at 10:13
0

Thanks for all the suggestions, the solution turned out to be a bit more involved. The master page I was trying to deploy has code behind in the GAC, and one of the libraries that referenced was missing - hence the "file not found" errors. Unfortunately because of some logging problems I've also been having, I couldn't see what file was missing!

For anyone else reading this question, the markup that works for me is that currently displayed in the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.