SIGN UP MEMBER LOGIN:    
ARTICLE

Creating a custom Master page in SharePoint 2010 using Visual Studio 2010

Posted by Vijai Anand Articles | SharePoint January 24, 2011
In this article we will be seeing how to create a custom master page in SharePoint 2010 using Visual Studio 2010.
Reader Level:

In this article we will be seeing how to create a custom master page in SharePoint 2010 using Visual Studio 2010.

Steps Involved:

  • Open Visual Studio 2010.
  • Go to File => New => Project.
  • Select Empty SharePoint Project from the installed template SharePoint 2010.

    1.gif
     
  • Enter the Name.
  • Click Ok.
  • Enter the local site that you want to use it for debugging.
  • Select "Deploy as a sandbox solution".
  • Click Finish.
  • Right click on the solution and click on "Add a new item".
  • Select the Module template from the installed templates.

    2.gif
     
  • Enter the name and click ok.
  • Rename the Sample.txt to Sample.master.
  • Replace the code with the following code snippet.

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="Module" List="116" Url="_catalogs/masterpage">
        <File Path="Module\Sample.master" Url="Module/Sample.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="false" />
      </Module>
    </
    Elements>
     
  • Go to the SharePoint Designer.
  • Open some existing site in the SharePoint Designer 2010.
  • Go to Navigation => Site Objects =>Master Pages.
  • Make a copy of v4.master.
  • Do some modifications in the copy of v4.master and copy the code.
  • Paste the code in the Sample.master.

Publish the master page:

  • Go to Site Actions => Site Settings =>Galleries => Master pages and page layouts => Module =>Sample.master.
  • Go to the ECB menu, click on "Check in".

    3.gif
     
  • Go to the ECB menu, click on "Publish a major version".

    4.gif
     
  • Go to the ECB menu, click on "Approve/Reject".

    5.gif
     
  • Select the "Approved" option. Click on Ok.

    6.gif

Change the master page of the SharePoint site with the custom master page

  • Go to the SharePoint Site => Site Actions => Site Settings => Site Collection Administration => Site Collection Features.
  • Activate the following feature "SharePoint Server Publishing Infrastructure".

    7.gif

     
  • Go to Site Actions => Site Settings =>Site Actions => Manage Site Features.
  • Activate the following feature "SharePoint Server Publishing".

    8.gif
     
  • Go to Site Actions => Site Settings => Look and feel => Master Page.
  • Select the custom master page as shown in the following.

    9.gif
  • Click Ok. 

erver'>
Login to add your contents and source code to this article
share this article :
post comment
 

http://mstechsharing.blogspot.com/2012/02/custom-master-page-and-page-layout.html i have an article with step by step. Thanks.

Posted by Do Quoc hung Feb 23, 2012

Hi, this article is very useful to me, i'm little bit new in sharepoint.. We take custom master page in this add custom webpart (with custom property) but in we cant edit webpart which in master page so i take one page for custom property and now i want to assign this to master page webpart property but i dont know how to get master page webpart instance and assign my page value to master page web part property?? Is this possible???? If yes than HOW?? And No than any alternate way to solve my ISSUE......

Posted by h v Apr 07, 2011

Why can i not find Module =>Sample.master under Site Actions => Site Settings =>Galleries => Master pages and page layouts? i just follow the steps you mentioned

Posted by howell shan Apr 04, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor