Xavier Poinas
Xavier Poinas

Reputation: 19743

Type exists in both System.Data.Common and System.Data.SqlClient

I have a ASP.NET Core web application (.NET 8) with only one dependency:

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />

I'm trying to add the Exceptional library:

<PackageReference Include="StackExchange.Exceptional.AspNetCore" Version="2.2.32" />

I have existing code referring to System.Data.SqlDbType, and after adding Exceptional I get the following build error:

The type 'SqlDbType' exists in both 'System.Data.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

How can I fix it?

Upvotes: 0

Views: 1101

Answers (1)

Xavier Poinas
Xavier Poinas

Reputation: 19743

I figured just adding an explicit reference to the System.Data.SqlClient package solved the issue:

<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />

Upvotes: 3

Related Questions