Errors When Trying to Use Existing app.config File

Topics: Enterprise Library Core
Feb 6, 2007 at 12:55 AM
I have a SCSF solution and I want to use the DAAB. I am using EntLib 2.0. I opened the Enterprise Library Configuration Tool for the first time to configure the DAAB and decided to use the existing App.config file created by the SCSF. After selecting the file I received an "unable to load assembly" error for Microsoft.Practices.CompositeUI and Infrastructure.Library. The error dialog said the solution is to copy the two assemblies into the bin folder for EntLib. I can certainly do that, but I am wondering if I did something wrong by trying to make use of the existing config file. Is it okay to do that?

Assuming I wanted to create my own config file, is there any guidance on where in a solution the EntLib config file should go and what name I can give it?


Feb 8, 2007 at 3:53 PM
Edited Feb 8, 2007 at 3:55 PM
It is okay to use the existing config file. In fact, I recommend it so you don't have to do a copy and paste from one file to another or manually add the entries which can cause all kind of problems if not done correctly.

I recommend copying over the assemblies to the EntLib 2.0 directory so you can use the configuration tool to add the DAAB configuration.

If you feel uncomfortable doing so, you can use the configuration tool to create a separate temporary configuration file and then copy and paste the configuration information for the DAAB to your real config file. There isn't much to copy and paste for the DAAB. It only adds:

    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=null" />
<dataConfiguration defaultDatabase="ConnectionString" />
    <add name="ConnectionString" connectionString="..." providerName="..." />

In fact you could just add the above to your file :) Just make sure you specify the proper connection string and provider. You probably already have a ConfigSections Area defined already, so you don't need to add it again. Just add the dataConfiguration Section Name.




David Hayden
Microsoft MVP C#