Creating an MSI Package for a WSP File in Visual Studio

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.

  1. Create a new Setup project: File -> New-> Project -> Other Project Types -> Setup and Deployment -> Setup Project
  2. Highlight the project and using the toolbar on the Solution explorer pane, select the User Interface Editor
  3. Configure the UI screens as you require
  4. On that same Solution Explorer pane, select the Custom Actions Editor and add the scripts below to the Install and Uninstall folders
  5. Using the File System Editor, add the wsp and license file to the Application Folder for use within the scripts below
  6. 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~1Common~1Micros~1webser~112BINstsadm -o addsolution -filename " + installDir + "CurrentlyPublishedPage.wsp", 0, true)
 
Return = oShell.Run("cmd /C C:Progra~1Common~1Micros~1webser~112BINstsadm -o deploysolution -name CurrentlyPublishedPage.wsp -allcontenturls -immediate -allowGacDeployment", 0, true)
 
Return = oShell.Run("cmd /C C:Progra~1Common~1Micros~1webser~112BINstsadm -o execadmsvcjobs", 0, true)
 
activationUrl = "cmd /C C:Progra~1Common~1Micros~1webser~112BINstsadm -o activatefeature -filename CurrentlyPublishedPagefeature.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~1Common~1Micros~1webser~112BINstsadm -o retractsolution -name CurrentlyPublishedPage.wsp -allcontenturls -immediate", 0, true)
 
Return = oShell.Run("cmd /C C:Progra~1Common~1Micros~1webser~112BINstsadm -o execadmsvcjobs", 0, true)
 
Return = oShell.Run("cmd /C C:Progra~1Common~1Micros~1webser~112BINstsadm -o deletesolution -name CurrentlyPublishedPage.wsp", 0, true)

, ,

Trackbacks/Pingbacks

  1. WSS 3.0 & MOSS: Creación de MSIs para desplegar soluciones! - Blog del CIIN - December 25, 2010

    […] Aunque normalmente en el CIIN trabajamos con las últimas versiones de tecnologías y plataforma como nuestro querido SharePoint, en ocasiones nos toca “regresar al pasado” para resolver cuestiones y problemas planteados por las empresas con las que colaboramos o miembros de la comunidad. En este sentido, una pregunta típica en el caso de despliegues de SharePoint es como poder crear paquetes MSI que nos permitan desplegar nuestras soluciones WSP en nuestro entorno de SharePoint. Por suerte, en este enlace tenéis un paso a paso de como hacerlo en Visual Studio. […]

  2. WSS 3.0 & MOSS: Creación de MSIs para desplegar soluciones! « Pasión por la tecnología… - December 25, 2010

    […] nuestras soluciones WSP en nuestro entorno de SharePoint. Por suerte, en este enlace tenéis un paso a paso de como hacerlo en Visual Studio. Dejar un comentario LikeBe the first to like this […]

Leave a Reply