How to create SharePoint Package:
SharePoint Project is Just like other website project in Visual Studio. It gives predefined templates which are user friendly and allows deploying custom solution to SharePoint Site. You may find templates are commonly used in our modules.
• Application pages
• User Controls
• Web Parts etc.
SharePoint project allows us to create our custom solutions as package, once package is created it can be deployed through Visual Studio or PowerShell Scripts, but you need admin privilege to execute this in both cases.
Steps to follow while implement SharePoint Package:
Open New Visual Studio with administration logins and choose New Project, and in left side of the page you just choose Office/SharePoint then chooses SharePoint solution. Then choose SharePoint Empty website and give a name for that.
After creating SharePoint project it’s asking the solution type by default it is selected as a “Display as a sandboxed solution” you just choose that as “Deploy as a farm solution”, then click on finish button.
After creating form solution the visual studio solution explorer becomes like below.
If you add user control, SharePoint Mapped folder ControlTemplates will be created and folder with your project name will be created inside this.
There are no.of folders are listed out in this case you just choose Template folder and then choose Control Templates then click on OK button.
If you add application pages the SharePoint Folder Layouts will be created and folder with your project name will be created inside this.
Create a folder under Layouts and give a name for that and inside that folder you just try to add Application Pages by right clicking on that folder and then choose “Add New Item” and then choose Application Pages and give a name for that.
You cannot view the designer in SharePoint project, and whenever you use user controls it will not resolve the name space automatically in designer.cs file so you need to manually replace all the entries of user control reference so that you will be able to build the project.
Create Web Service under Project:
Right Click on project and choose AddServiceReference then choose Advanced option in bottom left corner of the window.
Then choose Add Web Reference in bottom left corner of the window.
After choosing Add web Reference option a new window will appear to choose the service reference URL and then give a name for that service and choose OK to confirm that service information.
Create USER control under control Templates :
After that a new window will appear, it will show 2 options one is Application page information and another one is user control page information. Choose User control page option then give a name for that and click on ok button to create user control.
Create Application Pages:
Create a folder under Layouts give a name for that and then right click on that folder and then choose add new item then choose Application page and give a name for that page then click on Ok button for page creating under SharePoint package purpose.
• You can also add Webpart in the same project and use other SharePoint Project templates. But remember that all template which yet to deploy in server need to have same deployment scope.
• You can debug the solution using W3Wp process attachment or simply clicking debug button on visual studio but build should be in debug mode.
• Before you deploy solution in Production, package it under Release mode. If you use webpart in solution, feature file will be created and select appropriate scope (Site scope) for deployment.
• Always keep documentation about modification and backup of old package file of your solution in order to avoid hang over in production due to error in new package update.
• If you are using power shell scripts to deploy Solution it must be retracted before installing it.
I hope this article will help you for those who are try to create SharePoint package. As of my knowledge i share my views how to implement SharePoint package.