Visual How Tos


Configuring and Deploying Workflows to SharePoint Server 2007 Using Solution Packages

Summary: Learn how to configure and deploy a workflow to Microsoft Office SharePoint Server 2007 using a solution package.

Office Visual How To

Applies to: 2007 Microsoft Office System, Microsoft Office SharePoint Server 2007, stsadm.exe

Mike Rand, 3Sharp

June 2008

Overview

This Microsoft Office Visual How To covers how to configure and deploy a workflow to Microsoft Office SharePoint Server 2007 using a solution package. You will use the Microsoft Visual Studio 2008 solution that you created in Building an Expense Report Approval Workflow for SharePoint Server 2007 Using Visual Studio 2008.

Code It

Creating a Manifest.xml File

You must create a Manifest.xml file for your solution package. Open the Visual Studio 2008 project you created in the previous Visual How To: Building an Expense Report Approval Workflow for SharePoint Server 2007 Using Visual Studio 2008.

To create a Manifest.xml file

  1. Add a solution folder to the project.

  2. Select the solution in Solution Explorer.

  3. Right-click the solution, point to Add, and then click New Solution Folder. Rename the folder Solution.

  4. Select the new solution folder.

  5. Right-click the new solution folder, point to Add, click New Item, and then select XML File in the dialog box. Rename the XML file to Manifest.xml. Click Add.

  6. Add the following to the blank XML file.

    Xml
    <?xml version="1.0" encoding="utf-8"?>
    <Solution xmlns="http://schemas.microsoft.com/sharepoint/"    
     SolutionId="B90C9FD7-29F3-477f-A038-B4BA51FE219F">
      <FeatureManifests>
        <FeatureManifest Location="ExpenseFeature\feature.xml" />
      </FeatureManifests>
      <Assemblies>
        <Assembly Location="VS 2008 Expense Report WF Alpha.dll"
                  DeploymentTarget="GlobalAssemblyCache" />
      </Assemblies>
    </Solution>

    Specifying the DeploymentTarget attribute indicates that you want your DLL to be installed to the global assembly cache when the solution is deployed.

    Note Note:
    You can add the Wss.xsd schema to the schemas for this blank XML file. This will provide you with IntelliSense and validation while you are editing the Manifest.xml file.

Creating a Solution.ddf File

Next, you create a Solution.ddf file. This file is used to create your Solution Package. For more information, see the Microsoft Cabinet Software Development Kit.

To create a Solution.ddf file

  1. Select the solution folder that you previously created.

  2. Right-click the folder, point to Add, select New Item, and then select Text file.

  3. Rename the text file Solution.ddf. Click Add.

  4. Add the following to the blank Solution.ddf file.

    .OPTION EXPLICIT
    .Set CabinetNameTemplate=VS2008ExpenseReportWFAlpha.wsp
    .Set DiskDirectoryTemplate=CDROM
    .Set CompressionType=MSZIP
    .Set UniqueFiles="ON"
    .Set Cabinet=On
    .Set DiskDirectory1=.manifest.xml
    "VS 2008 Expense Report WF Alpha\ExpenseReportApprovalForm.xsn" 
      ExpenseFeature\ExpenseReportApprovalForm.xsn
    "VS 2008 Expense Report WF Alpha\bin\Debug\VS 2008 Expense Report WF Alpha.dll"
    "VS 2008 Expense Report WF Alpha\feature.xml" 
      ExpenseFeature\feature.xml
    "VS 2008 Expense Report WF Alpha\workflow.xml" 
      ExpenseFeature\workflow.xml
    
Note Note:
It is important to point out that both the Feature.xml and the Workflow.xml files must be put into a folder inside the solution package file. You do this by separating the source file and the destination with a space and then specifying a folder directory for the destination. "VS 2008 Expense Report WF Alpha\feature.xml" ExpenseFeature\feature.xml "VS 2008 Expense Report WF Alpha\workflow.xml" ExpenseFeature\workflow.xml
Note Note:
It is also important that you add your Custom Task form to this solution package. "VS 2008 Expense Report WF Alpha\ExpenseReportApprovalForm.xsn" ExpenseFeature\ExpenseReportApprovalForm.xsn

Creating the Solution Package

You are now ready to create the solution package. You need the Makecab.exe tool to create the solution package. If you do not have it on your computer, you can find it here: Microsoft Cabinet Software Development Kit.

To create the solution package

  1. Open a command prompt, and navigate to the solution directory.

  2. Run the following command to build the Solution.ddf file:

    makecab /f Solution.ddf

  3. You now have a solution package in your solution directory.

    Figure 1. Solution Package .wsp File

    Solution package .wsp file

Deploying the Solution Package

Now that you have a solution package, you have to deploy it. You must have the Stsadm.exe tool to deploy the solution package.

To deploy the solution package

  1. Open a command prompt and navigate to the directory that contains the Stsadm.exe tool.

  2. Run the following command to add your solution to a SharePoint server.

    stsadm.exe -o addsolution -filename [Solution Directory Goes Here]\VS2008ExpenseReportWFAlpha.wsp

  3. Now that your solution has been added to the SharePoint server, you must deploy that solution. Although you can deploy the solution using the SharePoint Server user interface (UI), you will use the command line in this scenario.

    Run the following command:

    stsadm.exe -o deploysolution -name VS2008ExpenseReportWFAlpha.wsp -allowgacdeployment -force -immediate

  4. You now must install your Feature to your site. Run the following command:

    stsadm.exe -o installfeature -name "VS 2008 Expense Report WF Alpha" -force

  5. Now that you have installed your Feature, you must activate it.

    Run the following command:

    stsadm.exe -o activatefeature -name "VS 2008 Expense Report WF Alpha" -url http://moss.litwareinc.com

    Your workflow has now been successfully deployed and activated on your SharePoint server. You can now navigate to your SharePoint site and add this workflow to a Document Library.

    Figure 2. Installed Workflow

    Installed workflow

Read It

Creating a solution package enables you to deploy your Feature to other servers. This is useful when you have a development server and one or more production servers. Creating the solution package requires that you use the Stsadm.exe and the Makecab.exe utilities. For links to more information about these utilities, see the "Explore It" section.

See It Configuring and Deploying a Workflow

Watch the Video

Video Length: 00:06:16

File Size: 9.5 MB WMV

Explore It
Tags :


Community Content

FredMorrison
Use WspBuilder to automate all of this
Instead of manually creating manifest.xml, solution.ddf and ultimately, the wsp file, why not install WspBuilder Extensions for Visual Studio 2008 (http://www.CodePlex.com/WspBuilder) and let it take care of all of this for you? What a pity that even with the delivery of VSeWSS 1.2 for VS 2008, Microsoft still doesn't provide a built-in way to automate the creation of manifest.xml, ddf and wsp files. Thank goodness for third party replacements that do the job that Microsoft overlooked.

Martin Kearn - Microsoft UK
Also need to add Manifest.xml to the Solution.ddf file
The Solution.ddf sample code is missing an entry for the manifest.xml file. This is required in order to deploy the solution on SharePoint.

You'll need to add manifest.xml manifest.xml beneath the .Set DiskDirectory1=.manifest.xml line in Solution.ddf.

Also, I'd recomend creating a new GUID for the SolutionId in your Manifest.xml file. This will avoid problems if you ever use this exmaple for anything else on the same farm.
Tags : manifest.xml

Martin Kearn - Microsoft UK
Configure Visual Studio to Automatically Re-Create the WSP on Build

I find it handy to configure Visual Studio to automatically re-create the WSP Solution package as a post-build event. This way, your solution is always up-to-date with the latest version of your code.

To do this:

  • Right-click on your project in Visual Studio Solution Explorer and go to Properties
  • Go to the Build Events tab
  • Enter the following in the Post-Build event command line section
cd $(SolutionDir)
makecab /f Solution.ddf

Whenever you do a build now, your solution file (WSP) will also be updated.


leicafan
The Solution.ddf in this page is a little bit different than the one in the video
What Martin said is correct. The Solution.ddf has an error in listing the manifiest.xml.
If you look closely at the video, you will find that the line

Set DiskDirectory1=.manifest.xml

should be:

Set DiskDirectory1=.
manifest.xml

Tags :

Page view tracker