Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

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.

Also, you can read:
Export selected record to excel in SharePoint 2013 using the JavaScript client object model

App Step in SharePoint 2013 Designer Workflow

Steps to create Site column using Visual Studio 2013 in SharePoint 2013

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:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

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.

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

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:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

Next rename the Sample.txt to aspx page. It should look like below:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

Then put the below conent to the .aspx page.

<%@Page MasterPageFile=”~masterurl/default.master”%>

<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

<h1>This is our custom page which we have created using Visual Studio 2013</h1>

</asp:Content>

It should look like below:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

Also change the Elements.xml file like below:

<?xml version=”1.0″ encoding=”utf-8″?>

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

<Module Name=”Pages”>

<File Path=”Pages\MySampleSitePage.aspx” Url=”MySampleSitePage.aspx” />

</Module>

</Elements>

Now rename the feature to a meaningful name as shown in the fig below:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

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:

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013

Then you can navigate to the page url and you can see the page like below:

http://win-pfcp2dgt8di/sites/EnjoySharePoint/MySampleSitePage.aspx

Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013


Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013.

Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →