Using Smart Client with Enterprise Library 4

Wow!  Compatibility between SCSF and EL 4 has troubled me many a times in some of my critical projects. Visual Studio 2008 does not allow installation of EL 3.1 and SCSF is based on EL 3.1.

To install EL 4.0 and to make it compatible with SCSF on VS2008 – here are the steps:

1. Rebuild Block Assemblies
2. Update Guidance Package
3. Update SCSF Application
 

Rebuild Block Assemblies

1. Extract the Smart Client Software Factory Source Code.

2. Open the SmartClient.Offline solution located at the source code installation folder.

3. Remove from the SmartClient.EnterpriseLibrary and SmartClient.EnterpriseLibrary.Tests projects the references to the following assemblies:

     –  Microsoft.Practices.EnterpriseLibrary.Common
     -  Microsoft.Practices.EnterpriseLibrary.Data
     –  SmartClient.EnterpriseLibrary.Data.SqlCe

4. Add, In the SmartClient.EnterpriseLibrary and SmartClient.EnterpriseLibrary.Tests projects, references to the following Enterprise Library assemblies (located at Enterprise Library assemblies located at %Enterprise Library 4 installation folder%Bin):

     –  Microsoft.Practices.EnterpriseLibrary.Common.dll
     –  Microsoft.Practices.EnterpriseLibrary.Data.dll
     –  Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll

5. In the SmartClient.EnterpriseLibrary project, open SmartClientDatabase.cs file and replace the following using statement:

using Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe;

with:

using Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;

 

Updating the Guidance Package
 

 

 

1. Open the GuidancePackage solution located at the SC-SF source folder.

2. Open the App.config.template located under the folders located at TemplatesSolutionsProjectsShell.*.* (Shell.Basic.CS, Shell.Basic.VB, Shell.Extended.CS and Shell.Extended.VB) in the SmartClientFactoryPackage project.

3. Find and replace on each App.config.template file the string “Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.

4. Create a folder to store the new assemblies (e.g. at %SC-SF installation folder%Lib with EntLib 4.0). In this folder, copy the Enterprise Library 4.0 assemblies and the Smart Client assemblies generated in Step 1. You should have the same assemblies you have at %SC-SF installation folder%Lib but updated to use Enterprise Library 4.0.

5. Open the file CreateSmartClientFactorySolutionCommon.xml file located at RecipesCommon folder of the SmartClientFactoryPackage project. You will change the path where the Create Solution recipe looks for the required assemblies by default.


6.
 Find the SupportLibrariesPath argument and replace it with the following:

<Argument Name=”SupportLibrariesPath” Required=”true” Type=”System.String”>
  <ValueProvider Type=”Evaluator” Expression=”Paste here the path to the folder created at Step 4″>
  </ValueProvider>
</Argument>

7. Save all.

8. Register the custom Guidance Package. To do this, right click the SmartClientFactoryPackage project and select Register Guidance Package.

 

Update existing SCSF Application

 

1. If your solution uses the Microsoft.Practices.SmartClient.EnterpriseLibrary.dll assembly, follow the steps described in the Rebuilding the Block Assemblies section to update this assembly and perform the following sub-steps:

  1.  
    1. Find the Microsoft.Practices.SmartClient.EnterpriseLibrary.dll generated assembly located at %Source code installation folder%BlocksOfflineSourceDataAccess.EnterpriseLibrarybinDebug.
    2. Copy the previous assembly and replace them in the Lib folder of your solution.
    3. Update the references of your projects to use the updated Microsoft.Practices.SmartClient.EnterpriseLibrary.dll assembly
    4. Remove the reference to Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe.dll (it was replaced with the one provided by Enterprise Library 4) and add a reference to Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll assembly located at %Enterprise Library 4 installation folder%Bin.

2. Copy the Enterprise Library 4.0 assemblies (located at %Enterprise Library 4 installation folder%Bin) and replace them in the Lib folder of your solution.

3. Update the references to the Enterprise Library assemblies in all the projects in your solution using the new assemblies copied into the Lib folder.

4. Open the App.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”.

5. Save all

Related Posts: