1 out of 1 rated this helpful - Rate this topic

How to: Configure Visual Studio 2010 for a Project Server Workflow

Office 2010

Published: May 2010

Developing workflows for demand management in Microsoft Project Server 2010 requires the use of Microsoft Visual Studio 2010. A Project Server workflow is a SharePoint site workflow, not a workflow that runs on a SharePoint list. Because Project Server workflows use custom activities and the Microsoft .NET Framework 3.5, you cannot use Microsoft SharePoint Designer to create Project Server workflows.

This article shows how to configure Visual Studio 2010 to create a workflow solution and how to add Project Server workflow activities and SharePoint Server workflow activities to the Toolbox. Because it is designed to develop workflows for Microsoft SharePoint Server 2010, we support only the use of Visual Studio 2010 with the Microsoft .NET Framework 3.5 for developing workflows. (This article is adapted from content by Sam Chung, Microsoft Corporation.)

This article includes the following sections:

When you create a workflow project in Visual Studio 2010, the Toolbox includes the SharePoint Workflow tab for Microsoft SharePoint Foundation 2010 workflow activities. To create workflows for Project Server 2010 and SharePoint Server 2010, the Toolbox must be updated with tabs for Project Server workflow activities and SharePoint Server workflow activities. Procedure 1 shows how to create a workflow project. Procedure 2 adds Project Server workflow items to the Toolbox. Using similar steps, Procedure 3 adds SharePoint Server 2010 workflow items.

Procedure 1. To create a workflow project

  1. Run Visual Studio 2010 as an administrator.

    Note Note

    To take advantage of automated deployment and debugging, and to add SharePoint Server workflow activities to the Toolbox, you must run Visual Studio on a test installation of Project Server.

  2. Create a project that uses the SharePoint 2010 Sequential Workflow template. In the drop-down list at the top of the New Project dialog box, select .NET Framework 3.5 (Figure 1).

    The name and location of the new project is not important for the following procedures; the project is just used as an example to help find all of the references and to set Toolbox tabs. For example, create a project named WorkflowProject1.

    Figure 1. Creating a SharePoint 2010 sequential workflow project

    Creating a sequential workflow project
  3. In the SharePoint Customization Wizard, in the What local site do you want to use for debugging? drop-down list, select the URL of the local Project Web App site (Figure 2). The option Deploy as a farm solution is selected by default. Click Next.

    Figure 2. Selecting the Project Web App site for the workflow

    Selecting the site for the workflow
  4. Type the name of the workflow (Figure 3). The first part of the name is the Visual Studio project. The second part of the name is the workflow class name. For example, WorkflowProject1 – Workflow1 is the default name.

    Click Site Workflow to make the workflow apply to a SharePoint site, instead of to a list.

    Figure 3. Naming the workflow project and class

    Naming the workflow project and class
  5. In the Select the lists you will use when debugging page of the SharePoint Customization Wizard, select Yes, associate this workflow with the following libraries and lists (Figure 4).

    In the drop-down list for the history list to display, use the default value Project Server Workflow History. In the drop-down list for the task list to display, use the default value Project Server Workflow Tasks.

    Note Note

    The workflow task list is the default list that contains workflow approvals.

    Figure 4. Selecting the SharePoint lists to use when debugging

    Selecting the lists to use when debugging
  6. On the last page of the wizard (Specify the conditions for how your workflow is started), select A user manually starts the workflow.

  7. Click Finish to create the workflow project.

When you create a workflow project for SharePoint Foundation 2010, the Toolbox pane in Visual Studio includes the Windows Workflow v3.0, Windows Workflow v3.5, and SharePoint Workflow tabs of workflow activities. To use the workflow activities in Project Server, you must add them to the Toolbox.

Procedure 2. To add a Toolbox tab for Project Server

  1. In Visual Studio Solution Explorer, expand the Workflow1 node, and then double-click the Workflow1.cs file to open the Sequential Workflow design view. On the View menu, click Toolbox, and then pin the Toolbox pane open.

  2. Right-click a blank area in the Toolbox pane, and then click Add Tab (Figure 5). For example, name the tab Project Server – Workflow.

    Figure 5. Adding a Toolbox tab

    Adding a Project Server workflow tab
  3. Right-click within the new Project Server - Workflow tab area, and then click Choose Items.

  4. In the Choose Toolbox Items dialog box, click the System.Workflow Components tab, and then click Browse. Navigate to the Microsoft.Office.Project.Server.Workflow.dll assembly in [Program Files]\Microsoft Office Servers\14.0\Bin, and then click Open.

    Note Note

    Some pre-release combinations of Project Server 2010 and Visual Studio 2010 required adding workflow activities to the .NET Framework Components tab in the Choose Toolbox Items dialog box.

  5. Leave all of the other items selected in the Choose Toolbox Items dialog box. Click the Namespace column header to sort the activities by namespace. There are ten Project Server workflow activities. The highlighted items (Figure 6) are those that will be added to the Project Server - Workflow tab in the Toolbox. Click OK.

    Figure 6. Choosing Project Server workflow activities to add

    Choosing Project Server workflow activities
  6. Right-click in the Project Server - Workflow tab area, and then click Sort Items Alphabetically. Figure 7 shows the Project Server 2010 workflow activity items.

    Figure 7. Project Server workflow activities in the Toolbox

    Project Server workflow activities in the Toolbox

SharePoint Server 2010 includes additional workflow activities that can be added to the Toolbox. The procedure is similar to Procedure 2 for Project Server.

Procedure 3. To add a Toolbox tab for SharePoint Server

  1. Right-click a blank area in the Toolbox pane, and then click Add Tab. For example, name the tab SharePoint Server – Workflow.

  2. Close the Project Server – Workflow tab and expand the new SharePoint Server – Workflow tab. Right-click within the SharePoint Server - Workflow tab area, and then click Choose Items.

  3. In the Choose Toolbox Items dialog box, click the System.Workflow Components tab, and then click Browse. Navigate to the Microsoft.Office.Workflow.Actions.dll assembly in [Program Files]\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI, and then click Open.

  4. Leave all of the items selected in the Choose Toolbox Items dialog box. Click the Namespace column header to sort the activities by namespace. Check the highlighted items in the Microsoft.Office.Workflow.Actions namespace that will be added to the SharePoint Server - Workflow tab in the Toolbox. Click OK.

  5. Right-click in the SharePoint Server - Workflow tab area, and then click Sort Alphabetically. Figure 8 shows the SharePoint Server 2010 workflow activity items.

    Figure 8. Workflow activities in the SharePoint Server – Workflow tab of the Toolbox

    Activities in the SharePoint Server – Workflow tab

After you complete procedures 1–3, Visual Studio 2010 is ready to create workflow projects for Project Server 2010 and SharePoint Server 2010. The Project Server – Workflow tab and the SharePoint Server - Workflow tab in the Toolbox persist after you create them.

Date

Description

Reason

May 2010

Initial publication

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
In Procedure 2 and Procedure 3, try adding activities to a different tab
If you have trouble adding workflow activities to the System.Workflow Components tab in the Choose Toolbox Items dialog box, try adding the activities to the .NET Framework Components tab. $0$0 $0 $0I had the same problem.  See step 8 on page: http://www.projectserver-nirvana.com/index.php?option=com_content&view=article&id=25:comming-soon&catid=8:operations-and-administration.$0 $0$0 $0 $0$0 $0
Procedure 3. To add a Toolbox tab for SharePoint Server -- issue
I have followed the steps to use Visual Studio 2010 to create workflow projects for Project Server 2010 and SharePoint Server 2010.  After several attempts, I am unable to get Procedure 3 to work correctly.  Each time I browse for the Microsoft.Office.Workflow.Actions.dll assembly, click on it to Open and move the highlighted item to the new SharePoint Server - Workflow tab, all the items move to the Project Server - Workflow tab and my SharePoint Server - Workflow tab is empty.  I have tried multiple times.  Any ideas why the items won't move under the correct tab??
Fixing workflow items added to wrong tab
Catherine,

If they are added to the wrong tab all you need to do is drag and drop them to the tab you want them to be on. 

John
Path correction for Procedure 3, step 3
Hello, I'm using also Visual Studio 2010 Beta 2 and I have the same problem, but not only on the 3rd procedure, also on the 2nd one: when I add the controls to the Toolbox they are all greyed out and cannot be dropped onto the Workflow design surface.

Any idea why this happens?
Thanks