Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have this feature with a nice little master page inserted through a feature, and it works fine. Now I'm looking into theming, created a composable look. To choose this look in the design manager though, I need a preview file. I've successfully done this by simply manually uploading a preview file (just a copy of a default one).

Obviously I don't want to have to keep doing this, so I added it to the masterpage feature, added the file to the elements file. But when I deploy and check the Master pages and page layouts, the preview file is not there. The master page is, as well as the seattle and oslo master pages and their preview files.

Somewhere along the line my previewfile disappears!

This is the elements.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MasterPages" Url="_catalogs/masterpage" Path="" RootWebOnly="TRUE">
    <File Path="MasterPages\sharepoint_mysite.master" Url="sharepoint_mysite.master" Type="GhostableInLibrary">
      <Property Name="Title" Value="MySite MasterPage" />
      <Property Name="MasterPageDescription" Value="This is the MySite master page." />
    </File>
    <File Path="MasterPages\sharepoint_mysite.preview" Url="MasterPages/sharepoint_mysite.preview">
      <Property Name="Title" Value="MySite MasterPage Preview" />
    </File>
  </Module>
</Elements>
share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You should have Type="GhostableInLibrary" attribute for your preview.

I suppose MasterPages in your solution points to a document library. If you want to provision files from a module to a document library, ghostableinlibrary type must be used:

Specifying GhostableInLibrary means the file will be added to a document library in SharePoint together with a list item to accompany the file when it is added to the library

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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