Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
Install the Visual Studio 2008 SDK.
Create a VSPackage using the Visual Studio extensibility platform. For more information about how to do this, see How to Create a VSPackage.
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
Create a new specialized project that inherits from FlavoredProjectBase. All additional functionality for the custom workflow project should be added here.
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.
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.
Override the InitializeForOuter and SetInnerProject methods from the IVsAggregatableProject interface so that the packages are loaded in the following order:
The custom project.
The workflow project system.
The C# or Visual Basic project system.
This is done in the specialized class that was created in step 3.
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.
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.)
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.
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.
The new project flavor is then successfully installed. The new project type is available in the Add New Project dialog.