How to Create Master Page Using Design Manager in SharePoint 2013
I have made this tutorial as many of my existing and coming tutorials start with deploying a custom master page to SharePoint 2013.
First you need to make sure you have a development enviroment that is running SharePoint 2013 and have Visual Studio 2012/13 installed.
- Start by creating a “Web Application” and a new Site Collection in Central Admin for this tutorial.
- Open Visual Studio and create a new project (SharePoint 2013 – Empty project)
- Choose Deploy as farm solution, or if you make this for Online then choose Sandbox.
- When the project opens, click on the Project Name in the solution explorer and then set the property Site URL to the site collection you made.
- Now right click on the project and add a folder called FeatureElements
- Right click in the folder Feature Elements and add – > New Item, Under Visual C# -> SharePoint you create a new Module that you call MasterPages.
- Remove the sample.txt
- Open your web browser and go to the site you created (http://xyz:57) and in there go to Settings -> Site Settings -> Master pages and page layouts. Find seattle.master and download a copy of that master page to you desktop.
- Rename the seattle.master to “MyCustom.master”. Now go back to VS and right click in the MasterPages module and take Open Folder in File Explorer. Copy your MyCustom.master to that folder.
- Go back to VS and In the Solution Explorer menu, click Show All Files. You can then see the MyCustom.master in the MasterPages Module. Right click and include in project.
- Open the Elements.xml that are in the MasterPages module and remove all code and replace with his code.
- Now go to the Features Folder and you will find Feature 1, Rename the feature to “Activate.Custom.Master”.
- Double click on the feature to open it and Change the Title to “Activate Custom Master”.
- Set Scope as Site and make sure MasterPages are included, save and close.
- Now right click on the feature and Add Event Receiver.
- The feature receiver will open (the Activate.Custom.EventReceiver.cs). If not Open it.
The code under here will replace the default master page when you activate the feature and when you deactivate the feature it will restore to seattle.master. - Delete every thing under “public class ActivateCustomEventReceiver : SPFeatureReceiver {” and paste in the following code under the “{”
(My code example will show the full Code, just so that you get the full picture. I have commented in the code what part you should copy. ) - Right click on the project and take Deploy. If every thing is working you should see your MyCustom.master if you go to your site and choose Settings -> Site Settings -> Master Page.
- Your Project should look like this now. Good Luck!



