I've used the enterprise library in vb and c# in web apps to access a sql server database and that all works nicely
I'm trying to use it in a vb.net winform application now however and I'm having nowt but hassle.
I've reference the following .DLLs
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.ObjectBuilder2
and included them in the bin directory, which is the #1 solution to the problem
I've included the following lines into the app.config
I've imported the references too and when the code is executed on the line
I get the error message
Where "ConnString" is also in the app.config and is a connection string that also works in the web app.
Any ideas as to why it's working fine for web apps but not for win apps?
Thanks
I'm trying to use it in a vb.net winform application now however and I'm having nowt but hassle.
I've reference the following .DLLs
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.ObjectBuilder2
and included them in the bin directory, which is the #1 solution to the problem
I've included the following lines into the app.config
Code:
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
I've imported the references too and when the code is executed on the line
Code:
Dim db As Database = DatabaseFactory.CreateDatabase("ConnString")
Code:
An error occurred creating the configuration section handler for enterpriseLibrary.ConfigurationSource: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\dev\prog1\bin\prog.vshost.exe.Config line 7)
Where "ConnString" is also in the app.config and is a connection string that also works in the web app.
Any ideas as to why it's working fine for web apps but not for win apps?
Thanks