.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Create a WebPart and Manual Deployment in SharePoint 2010

Posted By:Jean Paul       Posted Date: February 22, 2013    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article I would like to explore the multiple ways of deploying a Web Part into SharePoint server. Here we are using PowerShell commands along with some manual steps to achieve it.
 

In this article I would like to explore the multiple ways of deploying a Web Part into SharePoint server.  Here we are using PowerShell commands along with some manual steps to achieve it.

Using PowerShell


Following are the important steps involved:

·  Create new Visual Web Part
·  Create Solution file for the Web Part
·  Use PowerShell to Add and Install Solution
·  Activate the Web Part
·  Insert the Web Part into site

Create new Visual Web Part


Open Visual Studio 2010 and create new Visual Web Part template.  Name the project and the Web Part as WebPartManualDeployment. 


Create Solution file for the Web Part


Now right click on the Solution Explorer and choose the Package option.


You can find the package file in the BIN\DEBUG folder. (if you are using Debug Configuration)




Copy the file path and we need to use this in the next step.

Use PowerShell to Add and Install Solution


Now open the PowerShell window.  We need to execute the following Cmdlets.

1.  Add-SPSolution
2.  Install-SPSolution
The first command adds the solution into the SharePoint farm.

The second command extracts and installs the solution.  It includes activities like deploying assemblies to GAC.

Enter the command:

Add-SPSolution -LiteralPath "YourPath\WebPartManualDeployment.wsp"

If the command succeeded please continue with the following command.

Install-SPSolution -Identity "WebPartManualDeployment.wsp" -GACDeployment -WebApplication http://yourservername/ 

Some of the possible errors you could receive are listed here:

Possible Errors


Error
Solution
Install-SPSolution : Admin SVC must be running in order to create deployment timer job.
Open services.msc and start the service named SharePoint 2010 Administration.
Install-SPSolution : A deployment or retraction is already under way for the so
lution "webpartmanualdeployment.wsp", and only one deployment or retraction at
a time is supported.

Go to Central Administration > System Settings > Manage farm solutions > Cancel / Retract the particular solution

After the installation step, your web part assembly gets deployed to the GAC.  You can type open the assembly folder and verify it.


You can see that our Web Part assembly got deployed there.

Once the above steps succeeded we can move to the next step.


Activate the Web Part


Now open your site and select Site Actions > Site Settings > Site collection features


 
You will get the following screen:


Click on the Activate button.

Note: Please note that the sandboxed solution assembly is not copied to the GAC until you specify GAC explicitly.  For more information you can use the Reference links.

Insert the Web Part into site



Now we are ready to use the new web part in our site.  Open the site and go to Site Actions > Edit Page.  From the Insert tab click the Web Part button.  You will be getting the following list.  Choose the Custom item from the first pane and our web part should be listed there.


Use the Add button to get the web part added to the site.  If you can see the screen as below, then we are done with the web part deployement.




References


  http://technet.microsoft.com/en-us/library/cc261736.aspx
  http://msdn.microsoft.com/en-us/library/ff798301.aspx

Summary


In this article we have explored Web Part manual deployment and the aspects involved.  The associated source code is attached with the article.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend