In this post, we will discuss how we can create and deploy SharePoint 2013 site pages or content pages using visual studio 2013. Content pages are pages where the content resides. To create a content page using visual studio 2013, follow the below steps.
Open Visual Studio 2013 then click on File -> New -> Project. This will open the New Project dialog box, From the left side from the installed templates, go to Templates -> Visual C# -> Office/SharePoint -> SharePoint Solutions. Then choose SharePoint 2013 – Empty Project. Make sure to choose the .NET Framework 4.5 version. Give a name and location as shown in the fig below:
Then give a local site for debugging. And then choose the option as a farm solution. You can choose here Sandboxed solutions also. But in this example, I have chosen a farm solution.
Then Right click on the Project then Add -> Add new project. In the Add New Item dialog box, from the installed templates select Visual C# Item, Office/SharePoint and then choose Module. Give a name for the Module as shown in the fig below:
Next rename the Sample.txt to aspx page. It should look like below:
Then put the below conent to the .aspx page.
<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>
<h1>This is our custom page which we have created using Visual Studio 2013</h1>
It should look like below:
Also change the Elements.xml file like below:
<?xml version=”1.0″ encoding=”utf-8″?>
<File Path=”Pages\MySampleSitePage.aspx” Url=”MySampleSitePage.aspx” />
Now rename the feature to a meaningful name as shown in the fig below:
Now it is time to deploy the solution. Right click on the Solution click on Deploy Solution which will deploy the solution to the local SharePoint site which you have provided at the begining.
But if you want to
deploy to any other server other than development servers like stage or production server then you can follow this URL to know how we can deploy the solution using PowerShell.
Once it is successfully deployed, we can verify the feature. Open your SharePoint site then click on the gear icon then Site Settings. Under Site, Actions click on Manage site features. This will open the Site Features page, you can see the “MyCustomPage Feature1” will be inactivate state as shown in the fig below:
Then you can navigate to the page url and you can see the page like below:
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013.
Hope this will be helpful.
-: FREE PDF e-Book Download :-
51 JSOM Examples in SharePoint Online
You May Also like the Following SharePoint Online Tutorials: