6

It seems like whenever I am developing a web part and I "Deploy" it from Visual Studio, everything gets deployed and works exactly as I would expect.

When I take my WSP and try to install it to a different environment using Management Shell it seems like it always requires a little tweaking to get everything working right.

Does anyone know if there is a set of Management Shell commands that I can execute that would exactly reproduce the Visual Studio Deployment process for a Farm Solution?

Currently I use these two:

Add-SPSolution C:\temp\mySolution.wsp

Followed by

Install-SPSolution -Identity mySolution.wsp -WebApplication http://sp-dev:10000 -GACDeployment

Should I be doing anything else?

2 Answers 2

6

The Visual Studio 'Deploy' command actually invokes all the deployment steps in the current project deployment configuration. If you go and check by default it performs many seperate tasks under the coverall of 'Deploy'. That's under the SharePoint tab of the project properties window.

The 'Deploy' function also does conflict resolution such as deleting the existing .webpart file from the gallery. This type of resolution needs to be included in your activate/deactivate logic as it's not done automatically within the code.

I would also recommend trying a deploy of the WSP locally on your dev machine using the same powershell script aimed for another environment before accepting the WSP as ready.

Deploy is a productivity aid and should not be assumed to leave you with the desired WSP state for deployment. If you use CKSDev please also note that 'Quick Deploy' also falls under the productivity aid banner and you always need to test proper script based deployment for the WSP validity.

4

Also enable your feature

Enable-spfeature -identity <featurename, id or object> -url http://yoursite

It is also worth mentioning that something that can be quirky is permissions.

To deploy (farm) solutions you need to be farm admin and local administrator. Some commands also require you to have shell admin role (add-spshelladmin). Read more on shell access on my blog here

Your Answer

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

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