CAB, Enterprise Library 3 and SCSF ERRORS

May 25, 2007

Author: Jeff Noble

I was so excited that the P&P team released Enterprise Library 3.0. I first want to congratulate them on a fine product. Nice Job! Ok, so I installed the 3.0, Enterprise Library 3 and then the new Guidance Automation Extensions (which had errors, see this post if you get them) and the New Guidance Automation Toolkit both from May 2007. Then I installed the new Smart Client Software Factory. AWSOME!

I opened my CAB project and BOOM! 44 errors to fix. It took a LOT of time to diagnose what the problem is, but I will skip telling you how great of a programmer I am and how well I can diagnose a problem (ok, maybe not).

Missed Version Tick OOPS

The Object Builder has been moved into it’s own project space on Codeplex. You can find it here (but don’t find it there now): http://www.Codeplex.com/ObjectBuilder. If you were to d/l the project and build it, it builds version 1.0.51206.0

CAB has not been updated to a new Production release at this time and so it was built with an older version of the Microsoft.Practices.ObjectBuilder.dll. CAB was built with 1.0.51205.0. I assumed that I could just rebuild the CAB solution with a reference to the latest ObjectBuilder and I would be fine. THAT DOES NOT WORK AS EXPLAINED BELOW.

Remember in the title of this article I also included Enterprise Library. Like the SCSF, and new Guidance extensions and toolkit, they are all compiled against the 1.0.5.2106.0 ObjectBuilder.

Here is the problem. Somewhere along the line, the Microsoft.Practices.ObjectBuilder.dll was changed and the version was not ticked to the next minor. Here is a picture of the Microsoft.Practices.ObjectBuilder.dll as it sits in explorer after being built from the Codeplex download from the ObjectBuilder project space:

 objectbuilder1.png

Here is an image of the SAME dll as it sits in the Enterprise Library 3.0 bin folder, see if you can see the difference:
 objectbuilder2.png

In the statusbar (footer) of the explorer window, you can see that both Microsoft.Practices.ObjectBuilder.dll files are the SAME version, but the size of the files in the properties window is quite DIFFERENT. O-O-P-S!

Fortunately the fix is quite easy. The one in the Enterprise Library 3.0’s bin folder is the correct file. I opened the CAB project and removed the ObjectBuilder project from the CAB Solution, and referenced instead the Microsoft.Practices.ObjectBuilder.dll in the Enterprise Library folder.

Ok, CAB Builds, But My Project Is Still Broken

First, make sure you remove ALL of the references to CAB and replace them with the new one we just built. Then remove any ObjectBuilder References and use the ones from the Enterprise Library 3.0. You can also replace the Enterprise Library references while you are at it.

The next thing to do is to change your app.config to reflect the changes to your Enterprise Library Data, Logging and Exception Handling.

Normally you just change the lines which name the versions in your app.config (this file may be in the Constants folder in your shell project if you used the Guidance package).

<section name=”loggingConfiguration” type=”Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null” />

In our case, the Enterprise Library is now strong named so we need to change the PublicKeyToken to the actual strong name key. I changed the above line to the following:

<section name=”loggingConfiguration” type=”Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />

You will need to find EVERY mention of ANY type from the Enterprise Library and change these two values. They all use the same PublicKeyToken and are all version 3.0.0.0, so you can just blanket change them. Just make sure what you change IS part of the Enterprise Library. It is possible that you have other referenced dll’s in your app.config.

Your project with the new (fixed) CAB and the latest Guidance Packages and Toolkits installed, using the correct Object Builder are all set. You should be able to build your project once again all upgraded.

Painless! – NOT <grin>


SCSF May 2007 Still Makes VS 2005 SLOW – New Fix Instructions

May 25, 2007

In May of 2007, the Patterns & Practices group released a new version of the Smart Client Software Factory (SCSF). The problem is that Safe still doesnt get along with it. The fix for the old one has been out for some time, but apparently, feature are more important than performance at this point. Here is the procedure to fix it again.

New Fix for May 2007 Release

First you have to install the source, it no longer installs by default. If you installed SCSF in it’s default location, you can find the source code installer here:

C:\Program Files\Microsoft Smart Client Factory\Source Code Installer\SmartClientFactorySourceInstall.msi

This will install the source not to Program Files like the old one but to your project code in your profile?? I have no idea why it goes there, but because of the nature of how these projects interoperate with other P&P releases, I always leave them at their default locations. Lets jsut say I have learned my lesson in the past.

The new install location by default is:
C:\Documents and Settings\jnoble\My Documents\Visual Studio 2005\Projects\SCSF Source

  1. Open the GuidancePackage.sln.
  2. Expand the SmartClientFactoryPackage Project
  3. Expand the References Folder
  4. Edit the file ViewTemplateReferenceCS.cs
  5. Comment out the line vsProject.Refresh();
  6. Edit the file ViewTemplateReferenceVB.cs
  7. Comment out the line vsProject.Refresh();
  8. Build the solution and make sure you have no errors. If you don’t have NUnit installed, or the VSteam stuff installed, you can remove the projects from the solution (just ot get it to build).
  9. In windows explorer, open the folder:
    C:\Program Files\Microsoft Smart Client Factory\Guidance Package
  10. Rename the file Microsoft.Practices.SmartClientFactory.GuidancePackage.dll so we can roll back later if there is a problem. I used Microsoft.Practices.SmartClientFactory.GuidancePackage.dll.OLD
  11. In windows explorer, open the folder:
    C:\Documents and Settings\jnoble\My Documents\Visual Studio 2005\Projects\SCSF Source\GuidancePkg\Source\SmartClientFactory\
    SmartClientFactoryPackage\bin\Debug
  12. Copy the file Microsoft.Practices.SmartClientFactory.GuidancePackage.dll to the folder C:\Program Files\Microsoft Smart Client Factory\Guidance Package.
  13. Restart Visual Studio and your performance worries are over! Well at least for SCSF performance of menus. I can’t fix everything you know <grin>.