Tips & Tricks: Verify VS 2010 Packages WPSs Properly
If you’re building a solution for SharePoint 2010 within Visual Studio 2010 Beta 2 onward, ensure that your project is properly building & packaging your latest WSP bits. VS 2010 packages/creates your WSPs when you build the SharePoint Solution, but only when you fire off a package command before deploying the WSP. If you forget to issue a package command before deploying, you will be deploying the old version of the package and not the one you just built, meaning your changes are not included in the deployment. Larry Lau kindly suggested a couple of workarounds by including an AfterBuild target to trigger CreatePackage target in the csproj file.
<``TargetName``=``"AfterBuild"`` > ``<``CallTargetTargets``=``"CreatePackage"`` > ``</``CallTarget`` > ``</``Target``>
After a close examination of the Microsoft.VisualStudio.SharePoint.targets which is in the MSbuild file for SharePoint solution (responsible for packaging and deploying a WSP file), there is a property called IsPackaging that you can add to your project file to force build to package instead of doing what it does in the aforementioned.
Basically, in your build configuration you need to pass /p:IsPackaging=true as part of the MSBuild arguments if you’re building the entire solution or /t:package if doing just a project level build, and the wsp will be generated in addition to the assemblies.