In the first post of this series, we walked through the basic steps to creating a workflow in visual studio. In this second part, we'll cover the remaining 5 steps necessary to deploy that workflow onto a SharePoint list, and thereafter invoke that workflow which will create a task automatically and demonstrate that the workflow is indeed functioning.
Part 2: Deploying a .NET workflow onto a SharePoint List
- All visual studio workflows and their assemblies must be strongly named and deployed into the global assembly cache (GAC).
To do this, right click on the project and click "Properties". Under the "Signing" tab, check to sign the assembly and choose "New" in the drop down:

(Figure 1 – Signing an assembly with a new key pair file and public key token)
Type a name of "TestWorkflowKeyPair", and uncheck to password protect the assembly.
Lastly, build the project and drag and drop the resulting DLL file into the GAC, c:\windows\assembly
- All .NET workflows are deployed into SharePoint via a feature, and we'll need to create and deploy these feature files before we'll be able to instantiate our workflow on our SharePoint List. If you remember from my last post, the best way to do this deployment across your farm would be through a solution deployment. In order to keep this post concise, and since I'm deploying to a standalone development environment, I'm going to do a manual deployment of my feature. However, if you're curious about solution deployments, view this post that contains some links to some good content around that subject.
Now, to our manual deployment - you'll notice that the workflow template generated the "Deployment Files" folder with the feature.xml and workflow.xml files already available for us to edit.
Edit the feature.xml files as follows (you'll need to generate your own unique GUID - title, description, and version can be to your heart's desire):

(Figure 2 – feature.xml feature file details)
Edit the workflow.xml file as follows (replace the highlighted section with your public key token, learn how to retrieve here):

(Figure 3 – workflow.xml feature file details)
NOTE: the "CodeBesideAssembly" property CANNOT be wrapped or the workflow will fail! Don't wrap within the double quotes.
Save both those files and create a new folder under the 12 hive, TEMPLATE\FEATURES directory named "NewTaskWorkflow":

(Figure 4 – Feature folder example)
RESTART ISS! All the XML in the 12 hive is cached, so a restart is needed. Start -> run -> iisreset.
- Install and activate the NewTaskWorkflow feature.
Open STSADM.exe under the 12 hive, BIN folder, and run the following command: "stsadm –o installfeature –name NewTaskWorkflow":

(Figure 5 – STSADM operation completed)
Activate the newly installed feature by navigating to the "Site Collection Features" page, under "Site Action" -> "Site Settings". Scroll down until you see "New Task Workflow", and click "Activate":

(Figure 6 – activate the workflow feature at this Site Collection's scope)
- Enable the workflow on a SharePoint list and list item.
I'm going to create a new Issue Tracking list called "Development Issues", wherein I'm going to enable my custom workflow. Once you have the list created, click "Settings" -> "List Settings". Then, click the "Workflow Settings" link:

(Figure 7 – workflow setting location)
Because the workflow feature was activated at this site collection, you'll notice our workflow appears in the list of available workflows. Go ahead and give it a name:

(Figure 8 – workflow in list, and a name of "New Task Workflow")
The next setting is relates to the task list that we'll be adding items into. Since I don't have any existing Tasks lists, I'm leaving the default to create a new one. Workflow history is very similar, you can log information, at your discretion, to this history log. In the start options section, I'm going to change the setting so my workflow is automatically invoked upon a new list item being created.

(Figure 9 – additional workflow settings)
Click Ok. You'll notice if you go to view all site content, the Tasks list was automatically provisioned for us.
- Finally – let's navigate to our Development Issues list, and create a new issue. After you create the issue, navigate to your tasks list and you'll see a new task with "ACTION ALERT! New issue created!" as its title!
Congratulations! You're now a workflow expert! ;)
Click here to download my project if you couldn't get yours to work. Also, feel free to leave a comment if you have any questions.
Phil