Enterprise library 5.0 - assembly name or code base invalid error

Topics: Enterprise Library Core
May 20, 2011 at 6:31 PM
Edited May 20, 2011 at 6:33 PM

Hi,

I have converted .net 3.5 code to .net 4.0. I am referencing enterprise library 5.0 in my app.config file and added the dll's as reference in the project. I am having getting the following error:

The message is: An error occurred creating the configuration section handler for enterpriseLibrary.ConfigurationSource: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

I double checked if i am referencing the proper enterprise library and it is correct. Not sure how to resolve this. Any thoughts please ?

APP.CONFIG FILE

====================================================================================

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, &#xD;&#xA; Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>

<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources>
<add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, &#xD;&#xA; Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" filePath="D:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\test.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>

<appSettings>
<add key="Environment" value="Dev" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>

May 23, 2011 at 2:31 AM

Hi,

Try adding Microsoft.Practices.EnterpriseLibrary.Common and see if it works?

<sources> 
<add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" filePath="D:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\test.config" />
</sources>

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