7

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?

1 Answer 1

6

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.

3
  • 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?
    – empz
    May 11, 2011 at 20:05
  • Ok, I enabled the Feature via the web UI and now the webpart shows under the Insert > Webpart menu. Thanks
    – empz
    May 11, 2011 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). May 18, 2011 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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