0

So, is it possible? Tryied a lot of combinations (using google) in my farm-solution. Can't get it to work. What i did:

<Module Name="MasterPages" Path="MasterPages">
  <File Path="CustomMasterPage.master" 
  Url="_catalogs/masterpage/CustomMasterPage.master" Type="Ghostable"/>
  </Module>

and with relative path:

<Module Name="MasterPages" Path="MasterPages" Url="_catalogs/masterpage">
  <File Path="CustomMasterPage.master" 
  Url="CustomMasterPage.master" Type="Ghostable"/>
  </Module>

Also was trying with different Type attribute values. Seems first configuration to work (no errors while activating feature), but actually new master page is not displayed in master page gallery.
Btw, i use Share Point foundation. I tried this topic too, with Site and Webscope feature.

What am i doing wrong?

1 Answer 1

1

Ryan, You can deploy custom master page with module. Just make sure it is added to your feature. I have the working for a publishing site/SharePoint 2013. I assumed the name of your module is "MasterPages"

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MasterPages" List="116" Url="_catalogs/masterpage">
    <File Path="MasterPages\CustomMasterPage.master" 
Url="CustomMasterPage.master" Type="GhostableInLibrary">
      <Property Name="UIVersion" Value="15" />
      <Property Name="Title" Value="Custom Master Page" />
      <Property Name="ContentType" Value="Master Page" />
    </File>
  </Module>
</Elements>
3
  • Great! That worked. This is weird, cause of i already tried this (with List attribute and Type value as GhostableInLibrary. But without properties.
    – Ryan
    Apr 18, 2017 at 0:29
  • Btw, suspect Title property resolved this, i just did not see MasterPage in UI.
    – Ryan
    Apr 18, 2017 at 0:37
  • Feature scope should be Site
    – GuruKay
    Apr 8, 2020 at 21:11

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.