How To: Use SC-SF with Enterprise Library 4
The procedures described in this document assume that you have installed the
Smart Client Software Factory April 2008
Enterprise Library 4
Summary of Steps
- Rebuilding the Block Assemblies
- Updating the Guidance Package
- Updating Existing Smart Client Solutions
- 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 Smart Client Software Factory blocks to use Enterprise Library 4.0. These steps are needed only if you are updating an existing Smart Client Software Factory solution that uses the Offline capabilities or if you are
going to customize the Guidance Package to make it generate new solutions that use Enterprise Library 4.0.
- 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:
- 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):
- 5. In the SmartClient.EnterpriseLibrary project, open SmartClientDatabase.cs file and replace the following
|Note: Since Enterprise Library 4 already includes a provider for
Sql CE 3.5, SmartClient.EnterpriseLibrary project no longer needs to use the custom provider included in the
SmartClient.EnterpriseLibrary.Data.SqlCe assembly. In the previous steps, the SmartClient.EnterpriseLibrary project was modified to work with the new provider supplied by
Enterprise Library 4.
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.
|Note: If you are running on Vista with the User Account Control (UAC) activated, you must open Visual Studio with the option
Run as administrator.
- 3. Open the App.config.template located under the folders located at
Templates\Solutions\Projects\Shell.*.* (Shell.Basic.CS, Shell.Basic.VB, Shell.Extended.CS and Shell.Extended.VB) in the
- 4. Find and replace on each App.config.template file the string “Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.
- 5. 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.
- 6. Open the file CreateSmartClientFactorySolutionCommon.xml file located at
Recipes\Common folder of the SmartClientFactoryPackage 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">
Expression="Paste here the path to the folder created at Step 5">
- 8. Save all.
- 9. Register the custom Guidance Package. To do this, right click the
SmartClientFactoryPackage 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 Smart Client Solution
The following steps describe how to make an existing Smart Client Software Factory solution consume Enterprise Library 4.0.
- 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:
- Find the Microsoft.Practices.SmartClient.EnterpriseLibrary.dll generated assembly located at
%Source code installation folder%\Blocks\Offline\Source\DataAccess.EnterpriseLibrary\bin\Debug.
- Copy the previous assembly and replace them in the Lib folder of your solution.
- Update the references of your projects to use the updated Microsoft.Practices.SmartClient.EnterpriseLibrary.dll assembly
- 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
- 4. Open the App.config file and find and replace the string
“Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.
- 5. 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 Smart Client Solution