Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

Creating Workflow Flavored Project Types in Visual Studio

.NET Framework 3.5

The Visual Studio Extensibility Platform SDK can be used to create additional project types in Visual Studio for rapid development of Workflow projects that share common characteristics.

Creating a custom workflow project type

To create a custom workflow project type

  1. Install the Visual Studio 2008 SDK.

  2. Create a VSPackage using the Visual Studio extensibility platform. For more information about how to do this, see How to Create a VSPackage.

  3. Use the ProvideProjectFactory attribute to add templates to the VSPackage corresponding to the new project type being created. In this case, the templates are a custom workflow project, either a Sequential or State Machine workflow type, C# or Visual Basic language, and Code Only or Code Separation programming model For example, add this line to the VSPackageWFPackage.cs file:

    [ProvideProjectFactory(typeof(ProjectFactory), "ActivityLibraryFinal", null, null, null, @"C:\VSWFPack\Template\Projects")]
    Before the following line in VSPackageWF
    [Guid(GuidList.guidVSPackage2PkgString)]
          public sealed class VSPackage2Package : Package
    
  4. Create a new specialized project that inherits from FlavoredProjectBase. All additional functionality for the custom workflow project should be added here.

  5. Also add a ProjectFactory to the VSPackage project. The ProjectFactory acts as a router that invokes the appropriate package when a project of a specific type is being created. In this case, when the specialized project is invoked, the factory invokes the newly created VSPackage.

  6. Add the ProjectFactory GUID to the template workflow project file. This ensures that the package that corresponds to the project is loaded when a new instance of the flavored project is created.

  7. Override the InitializeForOuter and SetInnerProject methods from the IVsAggregatableProject interface so that the packages are loaded in the following order:

    1. The custom project.

    2. The workflow project system.

    3. The C# or Visual Basic project system.

    This is done in the specialized class that was created in step 3.

  8. As a modification to your flavored WF project, add a context menu command to the new template. The menu command can be accessed by right-clicking the project’s node in Solution Explorer.

  9. Build and execute the project to create a new instance of the workflow project flavor in the experimental hive (available with the Visual Studio SDK installation.)

  10. A PackageLoadKey is then obtained to port the project type to a new computer that does not have the Visual Studio SDK installed. See the How to: Obtain a PLK for a VSPackage topic in MSDN for details. The PackageLoadKey information is then added to the VSPackage using the ProvideLoadKey attribute.

  11. Create an installation package to install the new project type on any stand-alone computer. The setup changes the registry files, adds the templates, and puts in the package DLLs in the appropriate locations. Because the flavor is a ManagedProjectFlavor, ProjectAggregator2.msi must be installed on the new machine to recognize the new project flavor.

  12. The new project flavor is then successfully installed. The new project type is available in the Add New Project dialog.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.