When building my SharePoint projects with Visual Studio 2010, I prefer to use Package instead of Deploy. Even if I plan to deploy the wsp on my computer, I want to use my PowerShell scripts in order to test the deployment process for when I eventually deploy to a server that does not have Visual Studio.

If I go to the project properties page, I can add commands to either Build Events > Post-event command line or SharePoint > Pre-deployment Command Line. The former is too early because the solution package hasn't been built. The latter might work, but is there a way to quietly exit or cancel the deployment without receiving a "Build failed" error? If not, is there a way to edit the csproj file so that I can run a post-package command?

1 Answer 1


Have you tried creating a new deployment configuration on the SharePoint tab with Run Pre-Deployment Command as the only step and then putting your post-package command(s) in the Pre-deployment command line box?

...and make sure that you set Active Deployment Configuration to your newly created deployment configuration.

  • Perfect! I totally overlooked that section. That's exactly what I wanted. Thanks! Commented Jul 25, 2011 at 15:17

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.