Enterprise Library Configuration -- Fails to load nearly empty app.config file

Topics: General discussion
May 9, 2011 at 9:35 PM

I have a solution that has been working fine until our last set of changes.  We changed the target for the solution from .Net 3.5 to .Net 4.0.  I downloaded enterprise library 4.1 to upgrade from 4.0 which we had previously.  My mergeConfiguraiton.exe command fails and I can't even open the app.config file at all with Enterprise Library Configuration tool.  I have removed nearly everything from the app.config file.

<?xml version="1.0"?>
<configuration>
	
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

 

The error I get is:

 

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)File name: 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null'   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)   at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)   at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)   at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationDesignManagerDomain.Load(Assembly assembly)   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationDesignManagerDomain.LoadFrom(String path)   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationDesignManagerDomain.Load()   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationUIHierarchy.Load()   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationUIHierarchy.Open()   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.OpenConfigurationApplicationNodeCommand.OpenFile()   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.OpenConfigurationApplicationNodeCommand.ExecuteCore(ConfigurationNode node)   at Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationNodeCommand.Execute(ConfigurationNode node)   at Microsoft.Practices.EnterpriseLibrary.Configuration.Console.MainForm.OpenApplication()   at Microsoft.Practices.EnterpriseLibrary.Configuration.Console.MainForm.OnToolbarButtonClick(Object sender, ToolBarButtonClickEventArgs e)   at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)   at System.Windows.Forms.ToolBar.WndProc(Message& m)   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dllRunning under executable  H:\DevTFS01\Aurora\Aurora\MainBranch\Aurora2\Assemblies\EntLibConfig.exe--- A detailed error log follows. 
=== Pre-bind state information ===LOG: User = GREX\dwilliamsLOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified)LOG: Appbase = file:///H:/DevTFS01/Aurora/Aurora/MainBranch/Aurora2/Assemblies/LOG: Initial PrivatePath = NULLCalling assembly : Microsoft.Practices.EnterpriseLibrary.AppSettings.Configuration.Design, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null.===LOG: This bind starts in default load context.LOG: Using application configuration file: H:\DevTFS01\Aurora\Aurora\MainBranch\Aurora2\Assemblies\EntLibConfig.exe.ConfigLOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).LOG: Attempting download of new URL file:///H:/DevTFS01/Aurora/Aurora/MainBranch/Aurora2/Assemblies/Microsoft.Practices.EnterpriseLibrary.Common.DLL.WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKENERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Any ideas?

May 10, 2011 at 2:31 AM

I suspect there is a conflict with the assemblies from the previous version. Have you tried uninstalling Entlib 4.0 and see if it will resolve your issue?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

May 11, 2011 at 9:52 PM

It looks like there was something with the entlib install.  I'm not getting that error any more.  I'm getting a different error.  

I can compile the install project and when I run the installer I get an error:

Error 1001.  Could not find file c:\windows\system32\framework\root\EnterpriseLibrary\Microsoft.Practices.EnterpriseLibrary.Common_SN_31bf3856ad364e35_Version_4.0.0.mof

 

The path c:\windows\system32\framework doesn't exist.

May 12, 2011 at 3:14 AM

Hi,

I haven't encountered this issue yet but did you checked if c:\windows\system32\framework really exists? If yes then there might be some permission issue here. Also have you checked if your project is referencing now to Enterprise Library 4.1 assemblies? I'm not sure to this but looking on the error, it still referencing the old assemblies.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

May 12, 2011 at 2:05 PM
Edited May 12, 2011 at 2:15 PM

I went back to the 4.0 libraries to try to resolve this.  I uninstalled all EL except 4.0.  I did an undo-checkout in TFS and started fresh.  The path c:\windows\system32\framework does not exist on the drive.  I don't understand why it's looking there.

It seems to me it should be looking in 

C:\Windows\Microsoft.NET\Framework
May 13, 2011 at 6:27 AM

Hi,

This is really a weird issue. I can't even find any topic on web regarding the path "c:\windows\system32\framework". Are you using WMI in your project? Also, have you tried to reinstall EL 4.0 and see if it will solves the issue?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com