If a workflow is created using the Workflow Designer of SharePoint Designer 2007, deployment is simple. If a workflow is created by using Visual Studio 2005 Designer for Windows Workflow Foundation, you have to deploy and activate the workflow before it can be used. For more information about using Visual Studio 2005 Designer for Windows Workflow Foundation to create workflows, see http://msdn2.microsoft.com/en-us/library/ms441543.aspx.
Before you install and activate a workflow that is created using Visual Studio 2005 Designer, make sure the following tasks have been completed:
The workflow must be compiled as a strongly named assembly. This is a developer task.
A feature definition file (Feature.xml) must be present to provide SharePoint Designer 2007 with information that is necessary to deploy the workflow at the specified scope. This is also a developer task. It is advisable to open the feature definition file to check its contents. The following code listing shows a sample Feature.xml file:
<?xml version="1.0" encoding="utf-8"?> <Feature Title="[workflow template title]" Description="[workflow description]" Version="18.104.22.168" Scope="Site" ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=22.214.171.124, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Receiver xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="[workflow definition file]" /> </ElementManifests> <Properties> <Property Key="GloballyAvailable" Value="true" /> <Property Key="RegisterForms" Value="*.xsn" /> </Properties> </Feature>
A workflow definition file (by default, called Workflow.xml) must be present to provide SharePoint Designer 2007 with information that is necessary to instantiate and run the workflow. The creation of a Workflow.xml file is a developer task. It is advisable to open the workflow definition file to check its contents. The following code listing shows a sample Workflow.xml file:
<?xml version="1.0" encoding="utf-8" ?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Workflow Name="[workflow name]" Description="[workflow description]" CodeBeside CodeBesideAssembly="[namespace], Version=126.96.36.199, Culture=neutral, PublicKeyToken=[public key token]" > <Categories/> <MetaData/ > </Workflow> </Elements>\
For more information about feature definition (Feature.xml) files, see http://msdn2.microsoft.com/en-us/library/ms475601.aspx, and for more information about workflow definition (Workflow.xml) files, see http://msdn2.microsoft.com/en-us/library/ms439134.aspx.
If the feature definition and workflow definition files are present and valid and the workflow assembly is strongly named, the workflow is almost ready to be deployed. Next, you need to customize the Install.bat file that is used in deployment to ensure that running this batch file will deploy the workflow files to the correct location, copy the workflow assembly to the Global Assembly cache, and activate the workflow in SharePoint Designer 2007. The Install.bat file is included in the Workflow Developer Starter Kit for Windows SharePoint Services 3.0. The developer who created the workflow should be able to provide this Install.bat file to you as well.
Solution providers, independent software vendors, value-added resellers, and other developers that want to write custom workflows for SharePoint Designer 2007 should download the Workflow Developer Starter Kit for Windows SharePoint Services 3.0 from http://www.microsoft.com/downloads/details.aspx?familyid=&displaylang=en. This starter kit contains Visual Studio project templates for building SharePoint sequential workflow libraries, SharePoint state machine workflow libraries, and samples. The starter kit requires that the following applications are installed: Visual Studio 2005, SharePoint Server 2007, the Windows Workflow Foundation Runtime components, and Visual Studio 2005 Extensions for Windows Workflow Foundation.
Open the Install.bat file, and replace the placeholder text with the information taken from the workflow project. This encompasses the following information:
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
During the deployment process, the Install.bat file will do the following things:
Create a feature directory at the appropriate location on the server.
Copy the feature definition file, workflow definition file, and InfoPath form files (if present) into the feature directory.
Copy the compiled workflow assembly into the GAC.
Activate the feature in SharePoint Designer 2007.
After deployment, you can associate this custom workflow with the lists and libraries that are located on the SharePoint site that contains the activated feature for the custom workflow. To accomplish this, follow these steps:
Browse to the SharePoint site, and go to a list or library.
Click List/Document Library settings and then click Workflow Settings in the Permissions And Policies section.
Choose the custom workflow that was created in Visual Studio 2005 Designer from the Select A Workflow Template check box.