For anyone designing SharePoint Solution Packages (wsp files), typical deployment means either running stsadm commands to add a solution and then deploy it, or automating it via a script. However, if you’re building solutions that will be installed or administered by a client or a user not familiar with the stsadm command, then you’ll want to create something a little more user friendly.
That’s where MSI packaging can help. MSI packages also show up in add/remove programs and that makes it easier to manage for the end user. What i’ll outline in this blog post is some simple steps to get you going on creating MSI packages for sharepoint solutions files. To begin, i’ll assume you have already created a solution file and have it ready to go.
- Create a new Setup project: File -> New-> Project -> Other Project Types -> Setup and Deployment -> Setup Project
- Highlight the project and using the toolbar on the Solution explorer pane, select the User Interface Editor
- Configure the UI screens as you require
- On that same Solution Explorer pane, select the Custom Actions Editor and add the scripts below to the Install and Uninstall folders
- Using the File System Editor, add the wsp and license file to the Application Folder for use within the scripts below
- Building the solution will generate an msi file that you can now use to install your wsp. The msi will include all the necessary files, such as the license file, the wsp and the install scripts.
AddSolution.vbs
' VBScript File Set oShell = CreateObject("WScript.Shell") Dim activationUrl Dim targetDir Dim installDir targetUrl = Session.Property("CustomActionData") installDir = Session.Property("INSTALLDIR") Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o addsolution -filename " + installDir + "\CurrentlyPublishedPage.wsp", 0, true) Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o deploysolution -name CurrentlyPublishedPage.wsp -allcontenturls -immediate -allowGacDeployment", 0, true) Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o execadmsvcjobs", 0, true) activationUrl = "cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o activatefeature -filename CurrentlyPublishedPage\feature.xml -url " & targetUrl Return = oShell.Run(activationUrl, 0, true) |
RetractSolution.vbs
' VBScript File Set oShell = CreateObject("WScript.Shell") Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o retractsolution -name CurrentlyPublishedPage.wsp -allcontenturls -immediate", 0, true) Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o execadmsvcjobs", 0, true) Return = oShell.Run("cmd /C C:\Progra~1\Common~1\Micros~1\webser~1\12\BIN\stsadm -o deletesolution -name CurrentlyPublishedPage.wsp", 0, true) |