Errors with Enterprize Library and WPF

Topics: Data Access Application Block, Enterprise Library Core
Dec 17, 2009 at 4:02 PM

I am trying to explore using Enterprize Library with WPF and I immediately get an error when I try to build the simplest case (vannilla WPF app with nothing but the using Microsoft.Practices.EnterpriseLibrary.Data; statement).  The error I get is "Unknown build error, 'Cannot resolve dependency to assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.'".  The same application in Windows Forms compiles with no problems.  Does anyone know what I am doing wrong?  I tried switching around different using statements, and got some slightly different errors, but nothing would compile, let alone do anythinig useful.  Thanks.

Dec 17, 2009 at 6:16 PM
Edited Dec 17, 2009 at 6:22 PM

Hi rsjsteel,

I have encountered many such errors while attempting to update the Enterprise Library code for .NET4. WPF seems to have several dependencies that crossover from 3.5 SP1 to 4.0. I have not yet been able to document all of these issues but one example is the need to include "System.Xaml" for new builds versus the previous version. This is obviously due in some way to a reshuffling of namespace locations and you can usually resolve such issues fairly easily by using the beta version of Resharper 5 (provided free of charge for a short time). It will provide tooltips suggesting the appropriate imports that you should be using.

You can check the property page for the particular reference and determine the version that it is trying to resolve. Usually you can then delete the reference and add in the appropriate version from the list offered in the "Add Reference" dialog.

If you want to dig into this kind of issue more deeply you can download my .NET4 build of EntLib 5 on my experimental build site called Composure. After you see how I had to reconfigure some of the QuickStarts perhaps you will better understand where your particular problem lies. But be sure to switch back to the release version after you have completed your investigation. I don't want anyone inadvertently using my experimental builds for production work!



Dec 17, 2009 at 7:12 PM

Hello again rssteel,

One thing I should add is that if you are trying to use Visual Studio 2010 Beta 2 there seem to be some issues concerning references. You can sometimes drop what seems to be a correct reference that is failing, add it back in from the "Add References" dialog, and then it seems to be picked up properly. I can't for the life of me understand why that would be happening. But it just seems to do that every now and then.

I'm not sure if this is relevant if you are using VS2008 but you might want to try it anyway.


Dec 17, 2009 at 7:16 PM

BTW : My previous post about references applies primarily (and hopefully exclusively) to project references.


Dec 18, 2009 at 12:10 PM