In this post we will discuss how to Create a sharepoint hosted sample app using visual studio 2013. As we know since its a shatepoint-hosted app, we can not write any server side code. Only we will be able to write client side code in it.
Also check out:
Before opening visual studio 2013, I created a sharepoint 2013 developer site which I will as my local debugging site. SharePoint 2013 provides Developer site template under collaboration category.
Now Open Visual Studio 2013, Go to File -> New -> Project. This will open the Project template dialog box. From the left side select Office/SharePoint and then choose App for SharePoint Template as shown in the fig below:
In the next "New app for SharePoint" dialog box, Give the site url which you want to debug your app. and chose how you want to host the app. Here we choose SharePoint-hosted and then click on OK as shown in the fig below:
Now the solution explorer will look like below.
Here you will see only Default.aspx page not the .cs file because it is a SharePoint-hosted app so we could not able to write codes in it.
The solution contains a Features folder that contains the feature file which is required to activate the files associated with the sharepoint-hosted app. It also contains the Packages folder.
It also contains a Contet Folder will contains a css file App.css and Element.xml file.
Images folder contains the images like AppIcon.png as well as an Elements.xml file that keeps tracks of all items need to be deployed.
The pages folder contains the default.aspx page where we will work. Similarly the Scripts folder contains all the scripts required in the app.
Apart from that it also contains an AppManifest.xml file through which you can change Title, Name version etc of the App.
Now open the default.aspx and here we will display only hello world inside the PlaceHolderMain.
Now Right click on the solution and click on Deploy Solution.