Templates for Windows Workflow XAML activation projects

by Matt Milner 21. May 2007 09:43
One of my frustrations with Windows Workflow Foundation, is that there is no easy way in Visual Studio to create pure XAML workflows.  The tools really drive you toward compiling the XAML into a .NET assembly.  That, to me, defeats the purpose of using XAML.  So I created a bunch of project templates (console/library & state/sequence) that create pure XAML workflows using XAML activation.  This means the workflows are not compiled, the XAML is just copied into the build directory.  The console application project templates are setup in their program.cs to load these XAML files using an XMLReader and activate them that way. 
I also started working on XAML item templates so you could add individual items to a project. The problem I am having is I don't think there is a way in the project template directly to indicate that the file should be treated as content type of None and copied to the output.  I might have to write a custom wizard to get that part working.  If anyone has any easier means of accomplishing this, let me know. 
[Update]: I've updated the program.cs files in the templates to reflect some excellent feedback from my colleague Jon. The program now has template code to handle common exceptions when processing XAML files and also provides hooks to add types into a type provider.  In addition, I figured out that the wizard for the item templates was only a few lines of code.  To get the item templates working, you'll need to build the solution in the zip file and then either a) deploy the assembly to the GAC or to the VS\Common7\ide folder.  It needs to be in one of these two places for the VS template engine to trust it. 
Any feedback or questions, please post them in the comments.


Windows Workflow Foundation