Enterprise Library - Validation Application Block

Topics: CAB & Smart Client Software Factory
Feb 20, 2007 at 4:33 AM
I have today started incorporating the Validation application block to my Smart Client Solution.
I started with the Web Service and I added references to Validation, Common and also Microsoft.Practices ObjectBuilder version 1.0.51206.0

I managed to successfully Validate my Object and generate an exception, which I sent back to the client.

So far so good.

I then wanted to try and do Validation at the client end. I followed the instructions.

The ObjectBuilder is now giving me grief. It’s a different version than the version that came with the CAB (1.0.51205.0) and when I compile my application I get the following error.

The type 'Microsoft.Practices.ObjectBuilder.IBuilderAware' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=null'.

The error is specific to WorkItemController.cs which inherits from Microsoft.Practices.CompositeUI.WorkItem which in turn inherites the IBuilderAware interface.

I’m lost as what I need to do to overcome this problem. Any suggestions please as to how to get past this point?
Feb 20, 2007 at 10:31 AM
I think you're going to have to re-compile the CAB against the later version of the Object Builder that comes with Ent Lib 3.0.

There have been several posts on this problem on the Ent Lib forum. The current status seems to be that as Ent Lib 3 is only a CTP/beta there is no official support for integrating it with other application blocks. The hope is that a solution will be provided when Ent Lib 3 is formally released (due in March I think?). As I understand it the Object Builder version in Ent Lib 3 only differs from the version used in the CAB by a couple of patches (i.e. no new features), so it should be a fairly safe move. I have however heard of SCSF conflicts with the Logging AB in Ent Lib 3 - that's not a problem for me because we don't use it, but you might?

I have the same problem - I really want to use the VAB in a SCSF/CAB application. I'm going to try the re-compile of CAB/SCSF against Ent Lib 3 CTP and see how I get on.

The other option is to try side-by-side usage of Ent Lib 2 and 3 using assembly aliases. Looks messy to me, especially because the compiled DLLs from both versions have the same file names, which will clash in your solution /bin.

I think ChrisHolmes has mentioned using the VAB in an earlier post here, so maybe he may be able to provide more info?
Feb 20, 2007 at 10:12 PM
I did a build of the CAB and SCSF (the community release that has the Service Agent recipie) against Ent Lib 3. (I'm also using the Infragistics CAB so I had to rebuild that to.) I had to manually fix all references in my existing SCSF solution to refer to Ent Lib 3 and the new CAB assemblies. I also had to fix some of the app.config entries for Ent Lib to refer to the new dll versions (2.9.x). Seems to be working now, and I am able to use the Validation Application block.
Feb 22, 2007 at 1:27 AM
Edited Feb 22, 2007 at 1:28 AM
I was contemplating the same idea! After reading of your success I did the same. I recompiled the CAB with the new Microsoft.Practices ObjectBuilder version 1.0.51206.0. When doing so, I received a heap of errors, but they all related to the Unit Testing applications. I do not have VSTS and could not change them.

I noted however that the rebuilt the libraries had no errors. You can test this by right-clicking on each module and select Build and it only builds that module.

I also rebuilt CompositeUIExtensions.Winforms as I am using an Outlook type interface.

I then added the new libraries to my SCSF application and it compiled successfully.

I then updated all my Microsoft.Practices.EnterpriseLibrary reference with the new January 2007 release. I changed the App.Config in the Shell application by replacing all occurrences of with and the PublicKeyToken to b03f5f7f11d50a3a for all references to the Enterprise Library.

I recompiled and the application worked as expected.

So back to Validating my View….