3

I have seen few videos and read articles on creating/deploying custom master page via visual studio in SharePoint 2010. I would like to know if there is any manual/walk-through that shows how to create MasterPage for SharePoint 2013.

I have created an empty SharePoint project in Vs2012 and added a module to it. Then, I created a file called 'testmaster.master' which is copy of 'seatle.master' and added it under the module. Now I need to know what values do I set under the elements.xml file under the modules. And also about the feature properties.

I am following this link. Would like to know if its correct and any more link reference which you have tried and works!

Foll. is code under my master page modules elements.xml file and the master page gets deployed and works as expected when activated, is it good practice? :-

 <Module Name="SpeedMaster" Url="_catalogs/masterpage">
    <File Path="SpeedMaster\speed.master" Url="speed.master" Type="GhostableInLibrary" >
      <Property Name="Title" Value="SpeedMaster Master Page" />
    </File>
  </Module>

Thanks.

7

You will need something like this:

<Module Name="Masterpage" Url="_catalogs/masterpage">
    <File Path="Masterpage\mynewmasterpage.master" Url="mynewmasterpage.master" Type="GhostableInLibrary" Level="Published" ReplaceContent="TRUE">
      <Property Name="Title" Value="My New Masterpage" />
      <Property Name="UIVersion" Value="15" />
      <Property Name="MasterPageDescription" Value="" />
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_masterpage_name;" />
    </File>
</Module>

The Url in the module node makes sure the files in the modules get deployed to the correct place (gallery, but also a document library perhaps). And in each file in the module, you can just specify the url starting from the modules' url.

For the feature: All you need to do is make it Site Collection scoped and add the module to it. Than you can deploy your solution, activate the feature and it your master page should be available.

The article you are following adds a feature receiver to automatically activate any prerequisites and set the Master Page to the new one automatically.

EDIT: Further explanation of the xml attributes on the File and Module nodes:

Resource: http://msdn.microsoft.com/en-us/library/office/ms434127.aspx

  • Module-Url: Destination location for all the files in the modules
  • Module-Path: Import location for all the files in the module (relative from Project Root)
  • File-Path: Import location for the file (relative from Module-Path)
  • File-Url: Destination location for the file (relative from Module-Url)
  • File-Type: Ghostable vs Unghostable, most of the time you want GhostableInLibrary
  • File-Level: A file needs to be published before the bulk of the users can see it
  • Can you please point me to link that gives details as to meaning of module URL, File URL, File LEVEL, etc. You have not mentioned PATH in the Module tag as it is shown in the article I am referring to. – variable Feb 26 '14 at 12:42
  • I am getting error as:-Error 1 Error occurred in deployment step 'Add Solution': Failed to load receiver assembly "SpeedSolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f86a44a3fe99741" for feature "SpeedMaster_SpeedMaster" (ID: 6b6a0169-9e92-40a6-bf73-b0b0478114bc).: System.IO.FileNotFoundException: Could not load file or assembly 'SpeedSolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f86a44a3fe99741' or one of its dependencies. The system cannot find the file specified. File name: 'SpeedSolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f86a44a3fe99741' – variable Feb 26 '14 at 13:09
  • That error has absolutely nothing to do with the markup above, but rather a Feature Receiver you have added from the article. The most probable cause is that the Timer service in SharePoint is caching an old version of your solution .dll and hence can not load the event reciver you have created. Try to do an IISRESET and a net stop sptimerv4 net start sptimerv4 before activating your feature – Robert Lindgren Feb 26 '14 at 13:38
  • You have not mentioned the Module-Path in the code section. Is that optional? – variable Feb 27 '14 at 4:33
  • OK, I am using code as foolows and it works, is that OK to go ahead? <Module Name="SpeedMaster" Url="_catalogs/masterpage"> <File Path="SpeedMaster\speed.master" Url="speed.master" Type="GhostableInLibrary" > <Property Name="Title" Value="SpeedMaster Master Page" /> </File> </Module> – variable Feb 27 '14 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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