Hopefully you’ll have read the epic blog post yesterday on how to create a custom workflow template with Visual Studio 2005 and InfoPath 2007. Once you’ve followed through all the steps and the solution succesfully builds, we’re going to want to deploy our workflow to our MOSS 2007 server.
A workflow is basically a Feature. For a good definition of what a Feature is take a look here:
http://msdn2.microsoft.com/en-us/library/ms460318.aspx
To deploy our Feature we’re going to edit feature.xml, workflow.xml and Install.bat.
Feature.xml
In this file we’re going to add the xml that defines our features. If the ECM starter kit installed correctly you can add a code snippet to give you the outline of the feature.xml. If however your code snippets don’t work like mine, you can copy and paste this and edit it:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="553c6150-a1fb-4856-b06c-94c1fb1036e7"
Title="Demo Workflow"
Description="Demo Workflow Description."
Version="12.0.0.0"
Scope="Site"
ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="workflow.xml" />
</ElementManifests>
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<!-- Value for RegisterForms key indicates the path to the forms relative to feature file location -->
<!-- if you don't have forms, use *.xsn -->
<Property Key="RegisterForms" Value="*.xsn" />
</Properties>
</Feature>
The bits you need to worry about are:
Feature Id – generate your own guid for this
Title – give the Feature a meaningful title
Description – and a meaningful description.
The ElementManifest points to other files that are going to describe things that need to be deployed with your feature. Finally the Properties descibe that we want to register all the forms in the directory with a file extension .xsn. This is why we published our InfoPath 2007 forms to the same VS 2005 project directory.
Workflow.xml
Second xml file we need to edit is workflow.xml. Again you can either use a code snippet, or copy and paste the code below and edit it:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="Demo Sample"
Description="Demo Sample Description."
Id="28a74f98-1bef-4ca4-bd6b-a899315ea8c6"
CodeBesideClass="DemoWorkflow.Workflow1"
CodeBesideAssembly="DemoWorkflow, Version=3.0.0.0, Culture=neutral, PublicKeyToken=43ec7384e2e51f5a"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
AssociationUrl="_layouts/CstWrkflIP.aspx"
InstantiationUrl="_layouts/IniWrkflIP.aspx"
ModificationUrl="_layouts/ModWrkflIP.aspx">
<Categories/>
<!-- Tags to specify InfoPath forms for the workflow; delete tags for forms that you do not have -->
<MetaData>
<Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:DemoInitiation:-myXSD-2006-08-29T10-55-32</Instantiation_FormURN>
<Association_FormURN>urn:schemas-microsoft-com:office:infopath:DemoInitiation:-myXSD-2006-08-29T10-55-32</Association_FormURN>
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:DemoReview:-myXSD-2006-08-29T13-42-24</Task0_FormURN>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
Bits we need to worry about:
Workflow Name – give the workflow a decent name
Description – an again a good description
Id – generate another new Guid. This must be different to the Guid generated for feature.xml
CodeBesideClass – your project (assembly) name first, with the actual workflow class second.
TaskListContentTypeId – I don’t actually know what this part is for. If anybody knows please leave a comment!!!
Instantiation_FormURN and Association_FormURN – these are the Id’s of our DemoInitiation InfoPath form. You can get this by opening DemoInitiation.xsn in design mode, going File -> Properties, and copying it from the ID textbox

Also do the same for Task0_FormURN which needs the Id of DemoReview.xsn.
And that’s all you’ll need to edit. Apart from the last file that is, Install.bat. I’m not going to list this file as it’s pretty easy to edit. Basically rename the text MyFeature with the name of your project, wherever it is in Install.bat.
Now you need to remember that the workflow I wrote about yesterday is being developed on the same virtual machine as MOSS 2007. Because of this we can just run Install.bat locally where it is. If you wanted to install the workflow somewhere else you’ll need to change the paths, and server names respectively, or just copy the project to the server and run Install.bat from there.