Brendan Vogt
Brendan Vogt

Reputation: 26018

log4net configuration for connectionType version and public key for .NET 4.5

I am using the latest version of log4net. Just a couple of questions regarding the connectionType version and public key values.

The sample that you get on the log4net website looks like this:

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

I have seen on SO the following:

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

I am using Visual Studio 2012 and SQL Server 2008 R2. How do I know what version I will need to use and what will be the public key be (both seem to be the same for the 2 different versions)?

Upvotes: 3

Views: 6340

Answers (2)

Kinexus
Kinexus

Reputation: 12904

Framework 4.5 still uses 4.0.0.0 for System.Data.SqlClient. If you add the reference to any project and view the properties, you can see the details, including the path, which is;

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll

The public key will be the same for all versions.

Upvotes: 6

Sergey Berezovskiy
Sergey Berezovskiy

Reputation: 236208

Add System.Data to your project references (it already should be there). Select it and look to the properties window. You need Version property (should be 4.0.0.0). Set that version to your connection type value in configuration. Public key should stay the same:

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

Upvotes: 11

Related Questions