# How to deploy web part solution to multi-server farm?

I am having a heck of a time deploying a simple web part to a multi-server farm. The error I receive when deploying is: Error occurred in deployment step 'Activate Features': Feature with Id 'cd488818-dc38-4b3c-aa72-f34ce87a3d41' is not installed in this farm, and cannot be added to this scope.

It has been about a year since I deployed custom web parts to SharePoint 2010. Here are my questions:

• Is there a way to deploy from VS2010 to a multi-server farm?
• Can visual web part solutions be deployed only to a site collection? Or only to a web app? What's the scope that I have to use?
• Is there a PS script to do this?
-
Is cd488818-dc38-4b3c-aa72-f34ce87a3d41 the Id of your feature or is it a feature dependency? –  Per Jakobsen Jun 1 '12 at 19:32

For Web Parts your feature must use the Site scope. The Web Part Gallery only exists on the Site Collection level.

-

Visual Studio deploys to the server it's installed on, and as a best practice it shouldn't be installed on any production server. During the deployment process, the applicable bits for the solution will automatically be "deployed" to any server in the environment with the Foundation Web Application role. For deployment to production, the correct process would be to generate a WSP file from Visual Studio, load that to a single server in the environment, and use PowerShell Add-SPSolution c:\path\to\solution.wsp to add the file to the solution store. You can then use either Central Administration or PowerShell to perform the "deployment".
Once deployed, your feature(s) can be activated, either through the UI, or through PowerShell. If you have a lot of sites to activate the feature on, say you need to activate branding throughout the environment, you can use something like Get-SPSite | Enable-SPFeature -Identity "SolutionName" -Url \$_.Url which will iterate through all site collections and activate the SolutionName solution on each one. Note that this does need to match the scope for your feature (you wouldn't loop through sites for a web application feature, as an example).
All the deployment to production is the same regardless of number of Servers (Except SharePoint has to do more work when multiple). If you have more than 20 site collections you need to add -Limit All to Get-SPSite. A Visual web part usually has an elements.xml with a <Module> element to add the .webpart file to the Gallery <Module>s can only be in features with scope Site (Site Collection) or Web (Site) and you usually want to use scope Site –  Per Jakobsen Jun 1 '12 at 19:31