Partager via


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

Applies to: Office 2010 | Project 2010 | Project Server 2010 | SharePoint Server 2010

In this article
Creating a Workflow Project for Project Server
Adding a Toolbox Tab for Project Server Workflow Activities
Adding a Toolbox Tab for SharePoint Server Workflow Activities

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:

  • Creating a Workflow Project for Project Server

  • Adding a Toolbox Tab for Project Server Workflow Activities

  • Adding a Toolbox Tab for SharePoint Server Workflow Activities

Creating a Workflow Project for Project Server

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

    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

    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.

Adding a Toolbox Tab for Project Server Workflow Activities

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

    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

Adding a Toolbox Tab for SharePoint Server Workflow Activities

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.

See Also

Tasks

How to: Create a Branching Workflow

How to: Install and Test a Project Server Workflow

Concepts

Workflow and Demand Management