Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We've developed a custom Visual Web Part using Visual Studio 2010 for Sharepoint 2010 Server.

The webpart gets deployed when executed from VS (F5), so we can add it wherever we want using Sharepoint Designer for example.

But we need to use a more automated way for deployment, so I found it can be done using Powershell.

So the steps we did was the following:

  1. In Vistual Studio 2010: Build > Package to generate the .wsp
  2. Copied the .wsp to the /bin directory inside the Sharepoint website IIS dir (C:\inetpub\wwwroot\wss\VirtualDirectories\31953\bin in this case, because is running on port 31953)
  3. In Sharepoint 2010 Management Shell executed the following commands:
Add-SPSolution -LiteralPath "C:\inetpub\wwwroot\wss\VirtualDirectories\31953\bin\OutContext.wsp"

Install-SPSolution -Identity OutContext.wsp -WebApplication http://servername:31953 -GACDeployment

Then opened the site in Sharepoint Designer, try to find the webpart inside Insert > Webpart menu (under Custom category) but I couldn't find anything.

Any idea what I'm doing wrong?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

I think you still need to activate the feature that deploys your webpart. As far as I can see you have installed the solution and thereby installed the feature but not activated the feature that contains your webpart.

So add the line enable-spfeature -identity foobarwebpartfeature -url yourwebsite in your script to ensure that the feature is activated.

share|improve this answer
    
Ok, I've tried it and it throwed: "The Feature is not a Farm Level feature and is not found ina Site level defined by the Url servername:31953";. I've extremely poor Sharepoint knowledge. Do I have to point to the actual Site collection instea of the SP website root url? –  emzero May 11 '11 at 20:05
    
Ok, I enabled the Feature via the web UI and now the webpart shows under the Insert > Webpart menu. Thanks –  emzero May 11 '11 at 20:10
    
As a developer you should be aware what the Scope of your feature was: Farm, WebApplication, Site or Web. Knowing that you could activate/enable the feature using either PowerShell or the web UI /_layouts/ManageFeatures.aspx (add ?Scope=Site for site-collection scoped features). –  Alexey Krasheninnikov May 18 '11 at 4:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.