Sinapse
Sinapse

Reputation: 792

SqlConnection runtime failure after addin System.Data.SqlClient Reference

I am using .Net Core 2.0.0 and in a project I am using SqlConnection class from System.Data.SqlClient to establish an SQL Server connection. Up until now there were no problem and I was using it along with Dapper. Then I needed to use structured type and long story short I ended up adding System.Data.SqlClient package from nuget to build the project. But Then when I run the project, I receive this run-time exception

Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

Which is strange to me because I have this package installed and it was working just fine before I added System.Data.SqlClient. What can cause the problem and how to fix it?

Upvotes: 0

Views: 181

Answers (1)

Sinapse
Sinapse

Reputation: 792

I have found the answer, the problem was I was using .net core 2.0.0 preview2 version. After upgrading to .net core 2.0.0 release version the problem has been solved.

Upvotes: 1

Related Questions