How to: Deploy a Workflow Template
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Once you've created your workflow template and any necessary workflow forms, you still have to compile, install, and activate the workflow before you can actually use it in Windows SharePoint Services.
The basic steps for this are as follows:
Compile your workflow template as a strong-named assembly.
For more information on compiling and strong-naming your assembly, refer to the Visual Studio 2005 online help.
Create the feature definition file that provides Windows SharePoint Services with the information necessary to deploy your workflow at the specified scope.
Create the workflow definition file that provides Windows SharePoint Services with the information necessary to instantiate and run the workflow.
Set the deploy property so that building the solution deploys the workflow files to the correct location, copies the workflow assembly to the global assembly cache (GAC), and activates the workflow feature in Windows SharePoint Services.
The following procedures assume you have created your workflow template using the Windows SharePoint Services workflow project template. This project template, included in the Workflow Starter Kit, contains developer features specifically to help you create, deploy, and activate workflows for Windows SharePoint Services. The Workflow Starter Kit is available from the Microsoft Download Center.
To Create a Feature Definition File in a Windows SharePoint Services Workflow Project
In Visual Studio 2005, open your Windows SharePoint Services workflow project, and in the Solution Explorer window, double-click the feature.xml file.
Right-click anywhere in the feature.xml file, select Insert Snippet, select Windows SharePoint Services Workflow, and then click Feature.xml code.
Replace the highlighted placeholder text with the information from your workflow project. Placeholder text is formatted in all capital letters. This includes:
A GUID to serve as the feature ID. This must be different than the workflow ID specified in the workflow definition file.
The workflow template title.
A description of the workflow template.
The file path, relative to this file, of the workflow definition file. The project default is 'workflow.xml.'
Save your files.
To Create a Workflow Definition File in a Windows SharePoint Services Workflow Project
In Visual Studio 2005, open your Windows SharePoint Services workflow project, and in the Solution Explorer window, double-click the workflow.xml file.
Right-click anywhere in the workflow.xml file, select Insert Snippet, select Windows SharePoint Services Workflow, and then click workflow.xml code.
Replace placeholders with the information from your workflow project. Once you replace a placeholder once, it's replaced throughout the XML. This includes:
The workflow name, description, and unique identifier. This unique identified is for the workflow itself, not the Feature in which the workflow is included.
The code beside assembly and class name of the workflow assembly.
Locations of workflow and task forms used by the workflow.
For more information on creating workflow definition XML files, see Workflow Definition Schema.
Save your files.
To Install and Activate Your Workflow Template Using PostBuildActions.bat
In Visual Studio 2005, open your Windows SharePoint Services workflow project.
In the Solution Explorer window, right-click the project title, and select Properties.
On the Build Events tab, edit the Post-build command line string to deploy your workflow solution. By default, this parameter is specified as 'NODEPLOY'.
To deploy your workflow solution, the command line should read:
call "$(ProjectDir)\Deployment Files\PostBuildActions.bat" "$(ConfigurationName)" "$(ProjectDir)" "$(TargetDir)" "$(TargetName)"
DEPLOY > BuildActions.log
When the NODEPLOY parameter is specified, the workflow assembly is compiled but not deployed.
On the Build menu, select Build Solution.
Once Visual Studio has built your workflow solution, it calls the PostBuildActions batch file, which automates moving your workflow solution files to the correct locations for Windows SharePoint Services, and activating the workflow feature.
In Debug build mode, this batch file does the following:
Creates the feature directory at the appropriate location on the server.
Copies the feature XML and workflow definition XML files into the feature directory.
Copies the compiled workflow assembly into the Global Assembly Cache (GAC).
Activates the feature in Windows SharePoint Services.
In Release build mode, this batch file creates and deploys a .wsp solution file that can be used for deployment on a production server. It does the following:
Replaces placeholder text in the manifest.xml and wsp_structure.ddf files with the information from your workflow project. This includes:
The feature directory name.
The feature XML file name.
The workflow definition XML file name.
The name and relative path of the compiled workflow assembly.
Once you have activated your workflow template, it is available for administrators to associate with lists and document libraries on the site where it was activated.
Also, once you have associated the workflow with a specific list or document library, you can debug the workflow. For more information, see How to: Debug Your Windows SharePoint Services Workflow.