Tuesday, May 6, 2008

Upgrading your WCSF solution from June 2007 release to Feb 2008 release

You need to start from reading the original WCSF Wiki post describing how to perform an upgrade from the previous June 2007 release to the latest Feb 2008 release.

In a nutshell there are a few steps that you will need to do:
  1. Install .NET Framework 3.5
  2. Remove WCSF June 2007 release
  3. Upgrade your Guidance Automation software from any earlier release to the Feb 2008 for VS 2008 release
  4. Install WCSF Feb 2008 release
  5. Load your solution in VS2008 and make all the necessary changes.
That's a plan. Most if those steps are straight-forward and don't require additional explanations especially with the help of the original WCSF upgrade instructions. However there are a few tricky moments I'd like to focus on.
  1. When you remove the older Guidance Automation remember the following two rules:
    • First remove all the Guidance Automation packages installed on your machine;
    • Remove first the Guidance Automation Toolkit for VS and then remove Guidance Automation Extensions.

    If you happened to see an exception saying that some Guidance Automation Packages are still not removed while trying to uninstall the Guidance Automation Extensions you need to remove references to those packages first in order to be able to successfully uninstall Guidance Automation Extensions.
    Go to the Documents and Settings\..\Application Data\Microsoft\Recipe Framework folder and find a RecipeFramework*.xml file. Open it with a text editor and remove the content between GuidancePackages open and closing tags. Now you'll be able to uninstall Guidance Automation Extensions.

  2. After you installed WCSF Feb 2008 you'll need to enable it for your solution. It's done through the Visual Studio Guidance Automation Manager plug-in. The only thing that I'd recommend is to change a content of a vwd.webinfo file in the root fo your web site first because it differs for WCSF Feb 2008 comparing to WCSF July 2007. Make sure that the content of the vwd.webinfo looks like it's described here.

  3. Now you're ready to modify your code and here are the list of mandatory changes that you'll need to do in order to make your application working:

    • Remove the references to the previous WCSF assemblies from all your projects (basically they are foundation modules, business modules and web sites) and add the references to the WCSF Feb 2008 assemblies. Pay attention that there is no more such an assembly as Microsoft.Practices.ObjectBuilder.WCSFExtensions as it is merged into Microsoft.Practices.CompositeWeb.ObjectBuilder.

    • Modify all the [ModuleName]ModuleInitializer.cs files: in the ModuleInitializer Load method, use the concrete class CompositionContainer instead of ICompositionContainer.

    • Modify all the Pages code behind .cs files: a Presenter property now has both getter and setter methods and a setter method pattern is a bit different as shown below:
         [CreateNew]
      public [ViewName]Presenter Presenter
      {
      get { return presenter; }
      set
      {
      if (value == null)
      throw new ArgumentNullException("value");

      presenter = value;
      presenter.View = this;
      }
      }

      And also a page base class now should derive from a WCSF base class as shown below:
      public partial class [Module]_[View] : Microsoft.Practices.CompositeWeb.Web.UI.Page, I[View]

    • Optionally if you used a solution from WCSF_Contrib project for User controls then you'll have to alter those controls the same way as your pages.
So that's basically all. It does not look hard and should not take much of your time. But if you happened to have troubles feel free to post a comment here and I'll try to answer.

2 comments:

  1. I upgraded my WCSF and did not go into the deeper modifications as you have described.
    I only followed the simple steps and My solution runs fine.

    Will I have trouble in the long run?
    Please, I need to know.

    Thanks

    ReplyDelete
  2. Jackech, if the standard upgrade procedure worked for you then you don't need to worry. My post was meant for those who's gotten into troubles while upgrading their WCSF solution. And also I don't think you'd meet any troubles in a long run too. And of course if anything happened you'd always use this post :-)

    ReplyDelete