Summary: This post covers migrating a K2.net 2003 Studio Project to K2 blackpearl while documenting some of the pitfalls and how to avoid or work around them. After that I'll discuss how VB.Net support plays out in K2 blackpearl.
Converting a K2.net 2003 Project to K2 blackpearl
I'm currently assisting a client with migration of 5 processes from K2.net 2003 to K2 blackpearl. The original processes were developed in K2 Studio (2003 product) and the language selected was VB.Net.
We're currently running K2 blackpearl 807(with update 4.8210.2.370).
There are a few important steps before attempting project migration/conversion to K2 blackpearl:
- Install K2.net 2003 Developer components on the developer workstation.
- Install K2 blackpearl Developer components on the developer workstation.
- Run K2 blackpearl Configuration tool (happens automatically after a blackpearl install or upgrades).
WARNING: This should go without saying, but do not migrate your only copy of your source code, make sure to have a good backup first.
If you happened to install K2 blackpearl first and then added K2.net 2003 Studio, that's okay - just re-run the K2 blackpearl configuration tool so it can detect that K2.net 2003 Studio is installed since it is required for any code conversions/migrations.
Once the environment is setup, the migration path for a K2 Studio (2003) project is to simply open the K2 Solution file (.ksn) from Visual Studio 2005 and it will load the Conversion Wizard. There aren't any options to choose, just click on through to finish. At this point, depending on the size of your project, Visual Studio and the Conversion Wizard appears to have hung - it hasn't, it's just probably not doing the conversion in it's own worker thread so the UI will hang until the conversion process completes. Just stick around and wait, it will eventually complete.
Once the conversion completes, you will be able to view the migrated Processes in Visual Studio. To make sure the conversion process succeeded, build the project.
During my conversion, there were 300+ errors of:
"Statement is not valid in a namespace"
as well as:
class ’CDest1’ and class ’CDest1’, declared in ’C:\Documents and Settings\<userId>\Local Settings\Temp\ExtenderProjects\VBWinWF-c48c272384ac409dbf74701679ef6f65\DestinationRule_339d5b93cc814379b085361f550f7d4b.vb’, conflict in namespace ’<Default>’.
or even:
Expected class, delegate, enum, interface, or struct C:\Documents and Settings\<userId>\Local Settings\Temp\ExtenderProjects\CSWinWF-f3967973aafd4628aecca3469dbb4015\EventItem_e961c0616b7f46698827937752b6a0fb.cs 5 8 VSCSWinWF-f3967973aafd4628aecca3469dbb4015
These sorts of errors indicate a failure to convert properly and you should contact K2 support and request the following Hotfix:
KB000400 - Hotfix: K2 Designer for Visual Studio is unable to compile a project that contains a K2.net 2003 Artifact(s)
If you require the HotFix you'll need to install it and then restore your original K2.net 2003 project and re-convert. Once these errors are cleared up, anything remaining are most likely project references that need fixed.
Once all the code has been migrated and you can build successfully, there are a few additional things to consider if you are hoping to use VB.Net - the next section will cover that.
VB.Net Support in K2 blackpearl
A Quick Bit of K2 Compatibility Terminology
In K2.net 2003, Processes contain one or more Activities which contain one or more Events - when designing workflows in K2 Studio 2003, the Activity and Event Controls live in the Toolbox in K2 Studio and are called Templates (Activity Template and Event Template). In K2 blackpearl, Processes are still made up of one of more Activities which contain one or more Events, however they have changed the name from Template to Wizard. The Titles in Visual Studio Toolbox reflects this - if K2.net 2003 is install, you should also see the K2.net 2003 Templates in Visual Studio as well.
Compatibility in K2 blackpearl and K2.net 2003
If you've spent any time with the new Visual Studio K2 blackpearl extensions, you may have realized that there's no place to choose a language choice like there was in K2 Studio 2003 (vb.net or c#). This is not a mistake - currently all of the K2 blackpearl Wizards generate the underlying Workflow Foundation (WF) and Event Item code-behinds in C# only.
When converting K2 Studio 2003 VB.Net projects to K2 blackpearl, compatibility is maintained by using legacy K2.net 2003 Process, Activity and Event Templates within Visual Studio 2005 - this means that as long as you are in these Templates you can use VB.Net code within your processes. Additionally you can mix in the new K2 blackpearl Wizards in the process as well, but these will use C#.
This means for any Process based on a K2.net 2003 Templates, you can combine K2 blackpearl Activity and Item Wizards, however the one limitation is that you cannot have both a K2.net 2003 Event Item Template and a K2 blackpearl Event Item Wizard in the same Activity. This is because Activities are either based on the K2.net 2003 legacy Activity Template or the new K2 blackpearl Activity Wizard and you can only put like Events within an Activity.
Likewise - the same applies for a K2 blackpearl Wizards - K2.net 2003 Activity Templates and Event Item Templates can be mixed in a K2 blackpearl template, but not within the same Activity and to reiterate - all K2 blackpearl Event Items ONLY support C#.
Additionally - if you want to use VB.Net (or any other .NET language for that matter) as much as possible with K2 blackpearl (without using the K2.net 2003 Templates), then add another project to your Solution using the language of your choice and then add a reference to it in your K2 blackpearl Process. Then when when writing code, minimal C# code will need to be written to make calls to your VB.net library. Not necessarily perfect for a VB.Net purist, but it comes pretty close.
If you do not see the K2.net 2003 Templates within the Visual Studio Toolbox or if you want to import custom templates from K2.net 2003 to use within K2 blackpearl, see the following webcast by K2's famous Chris Geier for how to import the K2.net 2003 Templates: Using 2003 Templates in blackpearl
Please share your questions, comments, experiences with Migrations and converstions in the comments! I'll do my best to respond.
Posted
Thu, Apr 2 2009 1:16
by
j.monty