Introduction

This sample demonstrates how to use the Visual Studio 2012 tooling for Workflow Manager 1.0, including activity designers, debugging, and expression translation for authoring workflows. This sample requires the Workflow Tools 1.0 for Visual Studio 2012.

Installing Workflow Manager Tools

This sample requires the Workflow Manager Tools 1.0 for Visual Studio 2012, which can be installed using Web Platform Installer (Workflow Manager Tools) or from this download page:

This installer also pulls in the relevant pre-reqs, including Workflow Manager Client 1.0 and Cumulative Update 1.

Debugging using Workflow Manager Tools

  1. Launch the debugging executable as Admin using the command line:  C:\Program Files (x86)\Workflow Manager Tools\1.0\Microsoft.Workflow.TestServiceHost.exe
  2. Navigate to the sample folder and double click on ActivityLibrary.sln file.
  3. Under the project ‘ActivityLibrary’, investigate the content of the file ‘Activity1.xaml’.  Right click on the WriteLine activity in the Xaml file and select ‘Insert Breakpoint’
  4. Under the project ‘UsingWorkflowTools’, investigate the content of the file ‘Program.cs’. Update the scopeUri as appropariate.
  5. Build the solution.
  6. From the main VS menu bar at the top,
    1. Click ‘Debug’ --> ‘Attach to Process …’
    2. From the list of currently running processes, select ‘Microsoft.Workflow.TestServiceHost.exe’.
    3. Click the ‘Attach’ button.
  7. In Solution Explorer, right click on the project ‘UsingWorkflowTools’ and select ‘Debug’ à ‘Start New Instance’.
  8. Notice that the breakpoint in Activity.xaml is hit.
  9. Press continue to complete the debugging process.

Notes:

Using Expression Translation BuildTask

As described in the section Authoring Declarative Workflows for Workflow Manager 1.0, workflows hosted in Workflow Manager are fully declarative and therefore can only be authored using activities, expressions and variables from the trusted surface. The supported expressions will be translated into supported activities before the workflow definition is uploaded to Workflow Manager.

In order to provide a better authoring experience, Workflow Tools is shipped with the tool that can help validate the expressions in a workflow at the build time. The tool is known as “Expression Translation BuildTask”. Follow the steps below to learn more about the tool.

  1. Navigate to the sample folder and double click on UsingWorkflowTools.sln file.
  2. Under the project ‘ActivityLibrary’, in Activity1.xaml, replace the expression in the WriteLine activity (property “Text”) with an unsupported expressions. E.g. new Guid().ToString()
  3. Build the solution and notice that the build errors.
  4. In the Solution Explorer in Visual Studio 2012, right click on the project ‘ActivityLibrary’ and select ‘Unload Project’ from the menu options.
  5. Right click on the project ‘ActivityLibrary’ again and select ‘Edit ActivityLibrary.csproj’.
  6. In ActivityLibrary.csproj file, scroll down to the end of the file and notice the new Import element to the file. This target file is pointing to the expression translation build task which produces the translated workflow under the folder bin\Debug\TranslatedWorkflow. The translated workflows are the ones that we should use for publishing workflows to Workflow Manager.  Then right-click on the project ‘ActivityLibrary’ again and select ‘Reload Project’.

<Import Project="C:\Program Files (x86)\MSBuild\Microsoft\Workflow Manager\1.0\Microsoft.WorkflowServiceBuildExtensions.targets"/>

More Information

For more information on Workflow Manager 1.0, please see http://msdn.microsoft.com/en-us/library/jj193528(v=azure.10)