When deploying code, please use Solution Packages for both our sakes

written by Matt on Wednesday, April 02 2008

This morning I spent another 30 minutes trying to figure out why my solution package wasn't deploying correctly.  Oh, the deployment would report success.  No errors in the Central Admin UI or in the error logs, but several of the files on disk were not getting replaced.  Turns out that the problem was a combination of files being marked as read-only and due to manual copy and paste across networked machines, user accounts had not been kept in synch.  Once I marked the files I was targeting for replacement as not read-only and available to the service accounts, the solution deployment successfully overwrote the files

The SharePoint Solution Framework neatly assists developers and administrators by granting them the ability to put code out on multiple web servers and application servers with a few scriptable commands.  You can schedule deployments in production to occur late at night when no one is using the system.  You can roll back code which isn't working correctly.  You can upgrade code which is already in place without having to retract then redeploy.

C:\deploy>stsadm -o addsolution -filename UserLogin.wsp

Operation completed successfully.

C:\deploy>stsadm -o deploysolution -name UserLogin.wsp -allcontenturls -allowgac
deployment -immediate

Timer job successfully created.

C:\deploy>stsadm -o execadmsvcjobs

Executing .
Executing solution-deployment-userlogin.wsp-0.
Operation completed successfully.

C:\deploy>

WSPBuilder is a great addin for Visual Studio (2005 and 2008) from Carsten Keutmann which gives you some really excellent tools to work with the solution framework easily.  First and foremost, it ships with a number of project templates which you can expose when you add items to a project. 

WSPBuilder Item Templates

The templates pre-create a folder structure inside of your project which works easily with the next set of WSPBuilder's addin functionality.  Right-click on the project and you have the ability to easily deploy and upgrade code to your development machine.  You can also instantly connect to the IIS worker process for debugging.  I'd previously built a macro to do this based on blog posts from Andrew Connell but this mouse click option is even easier!

WSPBuilder

With tools like WSPBuilder working to make Solution Packaging and deployment so easy, it really should become the default way everyone creates SharePoint code, even in development.  There is just no excuse for copying files around web servers manually anymore.

Similar Posts

  1. Strange Problems with a mysteriously corrupted list
  2. SPLookupField Helper function
  3. Visual Studio reports the project location is not trusted

Comments are closed

Options:

Size

Colors