Monday, September 25, 2006

Migrating a BizTalk 2004 Solution to 2006

We have been developing a large enterprise workflow solution using K2.Net, BizTalk 2004, SQL Server 2000 on a Microsoft.Net 1.1 platform for the last few months. Our development strategy uses Virtual PCs to recreate the customer's environment minimizing deployment risks associated with developing large scale solutions. Our customer recently asked us to upgrade the solution to use BizTalk 2006 with SQL Server 2005 on a Microsoft.Net 2.0 platform. While most migrations require the upgrading of the BizTalk server for which there is quite a bit of documentation (see links below), we decided to create a new Virtual PC with a fresh installation of BizTalk 2006.

After starting up the new VPC and load the solution from source control I checked out the solution (I recommend you label your version of the solution in your source control system to make it easy to roll back should any issues arrise). From here the steps simple enough:

Visual Studio Conversion Wizard
  1. Step one requires running the Visual Studio Conversion Wizard. Open the solution with Visual Studio 2005.
  2. The Visual Studio Conversion Wizard starts up with a "Welcome" screen (click Next)

  3. A "Ready to Convert" screen (click Finish)
  4. I received a couple of warning messages, the first asking if I'd like my database project which uses an OLEDB provider for SQL Server upgraded to use the .Net Managed Provider for SQL Server. I chose Yes.

  5. The second warning message related to Web projects being converted to the new Web Site format. It removed all source control bindings.

  6. The "Conversion Complete" screen with the option to show the conversion report checked (click Close).
  7. The Conversion Report loaded within Visual Studio giving the results of the conversion process.

External Components
  1. Step 2 requires installing the new versions of external components, e.g. Enterprise Library for .Net Framework 2.0 and NUnit 2.2. Update the references in the solution projects and any obsolete method calls.
GAC Build Events
  1. Step 3 involved changing all build events used in project properties to add assemblies to the Global Assembly Cache (GAC). These are used in C# projects that are referenced from BizTalk and as such need to be added to the GAC. This requires a change in syntax as listed below:

    Visual Studio 2003:
    i. Pre-build: "%VS71COMNTOOLS%vsvars32.bat" && gacutil /u $(TargetName) ii. Post-build: "%VS71COMNTOOLS%vsvars32.bat" && gacutil /i $(TargetPath)

    Visual Studio 2005:
    i. Pre-build: call "%VS80COMNTOOLS%vsvars32.bat" && gacutil /u $(TargetName)
    ii. Post-build: call "%VS80COMNTOOLS%vsvars32.bat" && gacutil /i $(TargetPath)
External Strong Name Keys
  1. Step four required making Visual Studio 2005 use external strong name keys for signing the assemblies (to add assemblies to the GAC they need to be signed with a strong name key). The reason that I wanted to do this was two fold:
    • When trying to build the project in VS2005 the following compiler warning appears
      Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile'.
    • If you use the properties page to sign the assembly by selecting the strong name key it copies the key to your project file. This becomes a maintenance issue if you have multiple projects signed by the same key. You have all of the keys copied to mulitple project folders and duplicated in source control.

    Thanks to David Kean's blog on How to make Visual Studio 2005 use external strong name keys that managed to solve these issues. I've listed the steps here on how to do this with one extra step that I was required to take to get my projects to build.
    • Open the project file (.csproj) in a text editor.
    • In the tag under the tag, enter either an absolute or relative path to the key file, e.g. ..\..\Common\MyKey.snk.
    • Save the file and reload the project file in VS2005.
    • Right click on the project and select Properties. Select the "Signing" tab and check the "Sign the assembly" checkbox. The dropdown list below should show the path to the file e.g. ..\..\Common\MyKey.snk.

    For BizTalk projects, Right click on the project and select Properties. The Property Pages dialog box should appear. Navigate to Assembly under Common Properties and enter the path next to the "Assembly Key File" property. See the diagram below:


Finally
  1. Lastly, change any recommended warning issues that may arise. E.g. when using values from the tab in a configuration file the coding change required is as follows:

    Visual Studio 2003
    ConfigurationSettings.AppSettings["mySetting"]

    Visual Studio 2005
    Configuration.ConfigurationManager.AppSettings["mySetting"]
    Note: You need to add a reference to the System.Configuration.dll.
BizTalk Migration Links

1 Comments:

Anonymous Anonymous said...

Great info Sergio. BizTalk is a beast, and information like this is priceless!

10:44 a.m.  

Post a Comment

<< Home