Tuesday, November 25, 2008

Automation in Visual Studio 2005 for WSS v3 Feature Development

It is possible to create useful and time-saving tools for automation inside the Visual Studio 2005 IDE. In my development environment I've defined and frequently use tools to add, deploy, upgrade, retract, and delete a WSS Solution Package (wsp). My favorite of these tools is the upgrade operation, as it allows for a quick "build and test" iterative development cycle. Behind the scenes, each of these tools call the appropriate stsadm.exe operation and display the command's result in Visual Studio 2005's Output Window.

Add Solution command to tools menu of Visual Studio 2005:

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE

Arguments: -o addsolution -filename "$(ProjectDir)Package\$(TargetName).wsp"

WSP Solution Deploy Global

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o deploysolution -local -allowgacdeployment -allcontenturls -name $(TargetName).wsp

WSP Solution Upgrade

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o upgradesolution -local -allowgacdeployment -name $(TargetName).wsp -filename "$(ProjectDir)Package\$(TargetName).wsp"

WSP Solution Retract
Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o retractsolution -local -allcontenturls -name $(TargetName).wsp


WSP Solution Delete
Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o deletesolution -name $(TargetName).wsp