Saturday 27 August 2011

How to add wsp file in sharepoint 2010


In SharePoint 2010, user have many options to create and deploy solution packages for their custom development work, let me start with the most used method to create a solution package

1. Create Package using Visual Studio 2010 - Developers can build their SharePoint solutions in Visual Studio 2010 and produce .wsp files by using the automated build process. After you build your thing in VS 2010 using the SharePoint related templates available, you can just hit ctrl + F5. This will create a .wsp file and will also deploy it to the SharePoint server you are developing on.

Create a package - To Create a package in VS 2010, In Solution Explorer, click the project that you want to package. Then, on the Build menu, click Package.

Where is the .wsp - In Solution Explorer, click the Show All Files button. This shows all project items, including excluded and hidden items.Expand the bin node and
Expand the Debug or Release node to get your .wsp file.

Modify solution Package - When you create a SharePoint solution, Visual Studio adds the default SharePoint Features (or items) to the solution package. Before final deployment, you can add and remove SharePoint project items and Features using the SharePoint package. To open Package Designer In your Solution Explorer, right-click Package and then click View Designer.
Use Add\Remove (>) or(<) button to add the items into the solution package. In addition to select files for packaging, the Package designer allows you to set various properties for the deployment. Some of the properties that you can set are : 1. Name - It is a Required Property. The default name of the package is set to ProjectName. 2. Reset WebServer - Optional. Select if you want to restart the Web server after the .wsp file is installed on the SharePoint server. 3. Deployment Server Type - This is a Required Field. By default, the scope is set to ApplicationServer. 4. Items in the Solution - All SharePoint project items and Features that can be added to the package. 5. Items in the Package - Optional. All SharePoint items and Features that you want to deploy in your package. After, VS 2010 lets see at other options to create a solution Package in SharePoint 2010.

2. Solution Package by Using MSBuild -
Using MSbuild you can build, clean, and validate a SharePoint package (.wsp) using command-line MSBuild tasks on a development computer. For this you need to Open a Visual Studio command prompt window -> Cd to your Project folder -> Type the command
"msbuild /t:Package ProjectName.csproj" to create a package for the project. ProjectName is a name for the solution Package.

3. By Using PowerShell -
To Open the Windows PowerShell Session :

1. On the Start menu, click All Programs.

2. Click Microsoft SharePoint 2010 Products.

3. Click SharePoint 2010 Management Shell

Note : You should have SharePoint_Shell_Access role on the configuration database and you should be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint Server 2010 is installed.

Now, type in the following comamnds ( Note that the first two are needed only if the Solution already exists and you need to retract it before adding a new one.

Uninstall-SPSolution -identity {name of wsp file} -allwebapplications

remove-spsolution -identity {name of wsp file} -force

add-spsolution -literalpath C:\{FULL file system location\name of wsp file}

install-spsolution -identity {name of wsp file} -webapplication http://{URL of SharePoint site to deploy to} -GACDeployment -force

Ads by Google

No comments:

Post a Comment