How To: Use WC-SF with Enterprise Library 4

Prerequisites

The procedures described in this document assume that you have installed the Web Client Software Factory February 2008 and Enterprise Library 4.0.

Summary of Steps

  1. Rebuilding the Block Assemblies
  2. Updating the Guidance Package
  3. Updating Existing Web Client Software Factory Solutions
  4. Updating the QuickStarts and Reference Implementation (optional)
Note: If you want to use Enterprise Library 4.0 on new projects, you only need to perform steps 1 and 2.

Rebuilding the Block Assemblies

The first step consists of rebuilding the Web Client Software Factory blocks to use Enterprise Library 4.0.
  • 1. Extract the Composite Web Client Library Source Code.
  • 2. Open the CompositeWeb solution located at %WC-SF sources folder%\WCSFBlocks-Feb2008\CompositeWeb.
  • 3. In the CompositeWeb.EnterpriseLibrary project, remove the references to the following assemblies:
    • Microsoft.Practices.EnterpriseLibrary.Common.dll
    • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
    • Microsoft.Practices.EnterpriseLibrary.Security.dll
  • 4. Add the references removed in the previous step again, but use the Enterprise Library assemblies located at %Enterprise Library 4 installation folder%\Bin.
  • 5. Build the solution.

Updating the Guidance Package

The following steps describe how to customize the Guidance Package to make it generate solutions that use Enterprise Library 4.0.
  • 1. Follow the steps described in the section Rebuilding the Block Assemblies.
  • 2. Open the WebClientFactory Guidance Package solution located at %WC-SF sources folder%\GP.
  • 3. Open the Web.config and Web.config.wap files of the folders located at Templates\Solutions\Projects\WebProject.CS and Templates\Solutions\Projects\WebProject.VB in the WebClientFactoryPackage project (four App.config.template files in total).
  • 4. Find and replace in each Web.config and Web.config.wap files, the string “Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.
  • 5. Create a folder to store the new assemblies (e.g. at %WC-SF installation folder%\New Lib with EntLib 4.0). In this folder, copy the Enterprise Library 4.0 assemblies and the Web Client assemblies generated in step 1. You should have the same assemblies you have at %WC-SF installation folder%\Microsoft Practices Library but updated to use Enterprise Library 4.0.
  • 6. Open the CreateWebClientFactorySolutionCommon.xml file located at Recipes\Common folder of the WebClientFactoryPackage project. You will change the path where the Create Solution recipe looks for the required assemblies by default.
  • 7. Find the SupportLibrariesPath argument and replace it with the following:
<Argument Name="SupportLibrariesPath" Required="true" Type="System.String">
  <ValueProvider Type="Evaluator"
          Expression="{path to folder created at step 5}">
  </ValueProvider>
</Argument>
  • 8. Save all.
  • 9. Register the custom Guidance Package. To do this, right click the WebClientFactoryPackage project and select Register Guidance Package.
Note: If the Register Guidance Package doesn’t appear, you have to enable Guidance Package Development. To do this, go to the Tools menu, select Guidance Package Manager, click Enable / Disable packages, select Guidance Package Development, click OK, and Close.

Updating an Existing Web Client Software Factory Solution

The following steps describe how to make an existing Web Client Software Factory solution consume Enterprise Library 4.0.
  • 1. Follow the steps described in the Rebuilding the Block Assemblies section.
  • 2. Copy the generated assemblies CompositeWeb.dll and CompositeWeb.EnterpriseLibrary.dll located at %WC-SF sources folder%\CompositeWeb\bin\Debug and replace them in the Library folder of your solution.
  • 3. Copy the Enterprise Library 4.0 assemblies (located at %Enterprise Library 4 installation folder%\Bin) and replace them in the Library folder of your solution.
  • 4. Update the references to the CompositeWeb and Enterprise Library assemblies in all the projects of your solution and use the new assemblies copied in the Library folder.
  • 5. Open the Web.config file and find and replace the string “Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.
  • 6. Save all.
Note: It is possible that you’ll get exceptions related to changes in the new version of the Enterprise Library. Use the Enterprise Library Changes Log to review the changes and update your code.

Updating the QuickStarts and Reference Implementation

If you want to update the QuickStarts and the Reference Implementation to use Enteprise Library 4.0, you can follow the steps described in the section Updating an Existing Web Client Software Factory Solution.

Last edited Jul 25, 2008 at 3:53 PM by mconverti, version 4

Comments

tool12 Feb 12, 2010 at 11:47 AM 
At first, sorry for my English. I am not a native speaker.
I found another issue related to this approach (I migrated WCSF to EntLib 4.1). There were no context menu options (Add Page (with Presenter) etc.) after registering properly modified GP. I could see them in Guidance Navigator window/Available Guidance tab in VS, but not in context menu in Solution Explorer (right-click on WAP).
IMHO, there is subtle error in source codes for GP. WebClientFactoryPackage.xml needs to be modified to use D309F791-903F-11D0-9EFC-00A0C911004F GUID for WCSFWebApplicationProject and WCSFWebApplicationProjectFolder. Package GUID {F0E2A5AB-C5D9-416b-B5D9-A06ED6A7988E}, which in my case was there at first, is not valid in this case. When I did it and re-registered GP, everything was fine.
Of course, I have Web Client Software Factory - February 2008 installed.
(NOTE: GUIDs are correct in original location typically here (Windows 7): c:\Program Files\Software Factories\Microsoft Web Client Software Factory February 2008\WCSF Guidance Package ).

dschenkelman Jan 22, 2009 at 3:11 PM 
Hi

Blaine Wastell (P&P Program Manager) has posted in his blog the Roadmap for WCSF (http://blogs.msdn.com/blaine/archive/2008/12/03/roadmap-for-wcsf.aspx). As he says there, they are gathering feedback for the future version. To provide it you could create a workitem in the Issue Tracker (http://www.codeplex.com/websf/WorkItem/List.aspx) or create a post in this thread (http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41403) created by Michael Puleio (P&P Dev Lead) specifically for this purpose.

Please let me know if this helps
http://blogs.southworks.net/dschenkelman

MVC2008 Jan 12, 2009 at 11:03 PM 
Are you guys planning to release a new version of WCSF targetting Ent Lib 4.1?

elroyc Dec 31, 2008 at 7:37 AM 
I need to update WCSF to use Enterprise Lib 4.1 but I am having problem compiling Web Client Software Factory Solution. Looks like I got an old Microsoft.Practices.WizardFramework.dll (currently have version 1.4.0.0), which is expecting me to have 8.0.0.0 version. How can update the WizardFramework DLL?

The type 'Microsoft.WizardFramework.WizardPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.WizardFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

todthomson Oct 2, 2008 at 7:19 AM 
> You should have the same assemblies you have at %WC-SF installation folder%\Microsoft Practices Library but updated to use Enterprise Library 4.0.

In "C:\Program Files\Microsoft Web Client Software Factory February 2008\Microsoft Practices Library" I have the following assemblies:

AjaxControlToolkit.WCSFExtensions.dll
Microsoft.Practices.CompositeWeb.dll
Microsoft.Practices.CompositeWeb.EnterpriseLibrary.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Security.dll
Microsoft.Practices.EnterpriseLibrary.Validation.dll
Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.dll
Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.dll
Microsoft.Practices.ObjectBuilder.dll
Microsoft.Practices.Web.UI.WebControls.dll

In "C:\Program Files\Microsoft Web Client Software Factory February 2008\New Lib" I have the following (6) assemblies:

Microsoft.Practices.CompositeWeb.dll
Microsoft.Practices.CompositeWeb.EnterpriseLibrary.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.Security.dll
Microsoft.Practices.ObjectBuilder.dll

And these (2) extras (which makes sense)

Microsoft.Practices.ObjectBuilder2.dll
Microsoft.Practices.Unity.dll

And these (8) are missing:

AjaxControlToolkit.WCSFExtensions.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Validation.dll
Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.dll
Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.dll
Microsoft.Practices.Web.UI.WebControls.dll

With some more investigation you can see that (verify via the other 2 solution files):

AjaxControlToolkit.WCSFExtensions.dll
Microsoft.Practices.Web.UI.WebControls.dll

can be brought straight accross as they have no 'deps' on EntLib4.

And the other 6 DLLs are part of EntLib4 so you can just copy them across.

My hope is that this may help some others avoid the confusion that I had.

foxsean_mn Sep 24, 2008 at 4:08 PM 
Thank you for taking your time to explain this fix. It did not really work for me though. After following all the steps, when creating new WCSF solutions I am still looking at "Version=3.1.0.0~" in my web.config, as well as "Version=3.1.0.0~" dll's. After banging my head on my keyboard a few times, and considering reverting to EntLib 3.1,
I followed again your example, replacing all instances of "Version=3.1.0.0~" appearing in the Guidance Package solution, re-referencing any reference to "Version=3.1.0.0~" to point at "Version=4.0.0.0", I left the "SupportLibrariesPath" alone and changed the path in regedit. Then I registered the guidance package.
The gave me the right dll's upon creating a new solution, and only left me having to change my new web.config file in 9 places. I will do a backflip when WCSF comes out written with EntLib4 :) Sean

davior Jul 17, 2008 at 8:12 AM 
In Step 5 of the Section titled "Updating the Guidance Package" are you refering to the directory created at "C:\Program Files\Microsoft Web Client Software Factory February 2008\Microsoft Practices Library\" (by default)? Or some other location. What exactly is the "%WC-SF installation folder%"? Is it the one just mentioned? Or one of the Lib folders created by the "Web Client Software Factory Source Code Install" or the "Composite Web Client Library Source Code Install"?