views:

1133

answers:

2

Hello,

I have a web.config file that contains a section like this:

<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </configSections>
  <dataConfiguration defaultDatabase="dev"/>

And in my web deployment projects, I have a build that replaces the dataConfiguration section, using this line:

dataConfiguration=webStaging.dataConfiguration.config;

The file itself looks like this:

<?xml version="1.0"?>
<dataConfiguration defaultDatabase="staging"></dataConfiguration>

For some reason when I try to build it, I get this error:

Error 49 An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (\server\websites\scancenter\web.config line 22) C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets 614 9 ScanCenter_deploy

The unusual part about this is that I can replace other sections of web.config without any problem, and it's only when I include this replacement that I get an error. Any ideas?

Update:

I think this might be related. Our references to the enterprise library come from a UNC path, so we have refresh files that point to them.

A: 

I am sure you are missing something. Since you are using Enterprise library, I suggest you make use of the tool provided with it to build your config file.

i. Use the tool with enterprise library to construct your config file.

ii. I am sure it will work. Now go back to your code and try to identify the mistake.

rAm
I did use the enterprise library tool to rebuild my web.config, just to make sure it wasn't different. It is different - it does not include Version, Culture, and PublicKeyToken.I've heard that the EL tool is mistaken, but it doesn't matter, because either way the project doesn't build, unless I remove the section replacement.
Chris
A: 

I have the same problem. when replacing a custom section in the web.config i get the exception. An error occurred creating the configuration section handler for log4net: Could not load file or assembly 'log4net'

SimpleJack