Archive for Visual Studio 2012

SharePoint 2013: Create Master Page using Visual Studio 2012

Scenario:

You can find many blogs on how to create SharePoint 2013 master page in Visual Studio 201. We faced following issue while creating master page. Long story, we need to create master pages for our new SharePoint 2013 environment. As with our previous experience, we decided to create them in Visual Studio. Everything works fine but when we try to deploy wsp via Visual Studio 2012, master pages are not uploaded in “Master pages and Layout Library”. The problem was in the XML that was written in “Elements.xml” file.

Resolution:

Before moving to XML that worked, we would like to share all the XML that didn’t worked. We are not sure why they didn’t work. Perhaps, anything wrong on our side.

XML that didn’t work:

<Elements
xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MasterPages” RootWebOnly=TRUE >

<File Path=MasterPages\ABCIntranet.master” 

Url=_catalogs/masterpage/ABCIntranet.master” 

IgnoreIfAlreadyExists=true >

<Property Name=UIVersion” Value=15></Property>

</File>

</Module>

</Elements>


<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MaterPage” Url =_catalogs/masterpage” List=116>

<File Path=MaterPage\ABCIntranetMasterPage.master” 

Url=ABCIntranetMasterPage.master
Type=GhostableInLibrary” IgnoreIfAlreadyExists=FALSE />

</Module>

</Elements>


<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Url=_catalogs/masterpage” Name=MasterPage>

<File Url=ABCIntranetMasterPage.master” Type=GhostableInLibrary
IgnoreIfAlreadyExists=TRUE” 

Path=MasterPage\ABCIntranetMasterPage.master/>

</Module>

</Elements>

XML that did work is:

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MasterPage” List=116” Url=_catalogs/masterpage
Path=MasterPage” RootWebOnly=TRUE>

<File Url=ABCIntranet.master” Type=GhostableInLibrary >

<Property Name=UIVersion” Value=15 />

</File>

</Module>

</Elements>

Advertisements

Leave a Comment