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 content page using visual studio 2013, follow below steps.
Also you can read:
– 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 .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 farm solution. You can choose here Sandboxed solutions also. But in this example I have choose 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 server like stage or production server then you can follow this url to know how we can deploy solution using PowerShell.
Once it is successfuly 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 in activate 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 2013Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.