I recently came across an issue with the validation application block in EntLib 4:
I've got three projects in a solution:
EntLibTestApp (console app)
Persons (class library)
Vehicles (class library)
The Persons project contains a very basic class called Employee which has only one attribute called car. The type of the car attribute is CompanyCar which is defined in the Vehicles class library.
Now, in order to compile the Persons class library, I've added a project reference to the Vehicles project.
In the App.config file, I want to add a validation rule to validate the car attribute on the Employee.
I can add the Employee type to the Validation Application block, but once I want to choose members from the Employee type after adding a rule set, the entlib config tool gives the following unhandled exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Vehicles, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
The Vehicles assembly exists in the same folder as the Persons assembly which contains the Employee class.
Furthermore i've checked the name, version, culture and the publickeytoken of all assemblies involved, but everything seems fine.
If I want to do the exact same thing with the exact same project in EntLib 3.1, it works fine and the choose members window pops up perfectly well.
I also compared both the app.config file edited by the entlib 3.1 tool and the app.config file edited by the entlib 4.1 tool and found out that they are exactly the same:
<type assemblyName="Persons, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null" name="Persons.Employee">
<ruleset name="Rule Set" />
In order to isolate the issue from as much external factors as possible, i've created an empty console application and added just two class libraries to it.
Any ideas anyone?
Am I encountering an EntLib 4 bug here?
Thanks in advance