Here we are using PowerShell commands along with some manual steps to achieve it.Using PowerShellThe following are the important steps involved:
Create new Visual Web PartOpen Visual Studio 2010 and create a new Visual Web Part template. Name the project and the Web Part as WebPartManualDeployment. Create Solution file for the Web PartNow 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 the Debug Configuration.)Copy the file path; we need to use this in the next step.Use PowerShell to Add and Install SolutionNow open the PowerShell window. We need to execute the following Cmdlets:
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 the GAC.Enter the command: Add-SPSolution -LiteralPath "YourPath\WebPartManualDeployment.wsp"If the command succeededs then 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
Install-SPSolution : A deployment or retraction is already under way for the solution "webpartmanualdeployment.wsp", and only one deployment or retraction at a time is supported.
After the installation step, your web part assembly gets deployed to the GAC. You can type open the assembly folder and verify it.You will see that our Web Part assembly got deployed there.Once the above steps have succeeded we can move to the next step.Activate the Web PartNow 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 siteNow 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 see the screen as shown below, then we are done with the web part deployement.Referenceshttp://technet.microsoft.com/en-us/library/cc261736.aspxhttp://msdn.microsoft.com/en-us/library/ff798301.aspxSummaryIn this article we have explored Web Part manual deployment and the aspects involved. The associated source code is attached with the article.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: