Skip to content

System.BadImageFormatException when targeting .NET Framework #7

@mgravell

Description

@mgravell

Short version: net46 gives me:

System.BadImageFormatException : Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.0.19128.1, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Full repro branch https://github.com/StackExchange/Dapper/commits/ms-sqlclient


I'm using

<PackageReference Include="Microsoft.Data.SqlClient" Version="1.0.19128.1-Preview" />

nuget says this has builds for net46, netstandard2.0 and netcoreapp2.1 so I updated Dapper's tests from

 <TargetFrameworks>net452;netcoreapp1.0;netcoreapp2.0</TargetFrameworks>

to

<TargetFrameworks>net46;netcoreapp2.0;</TargetFrameworks>

(where netcoreapp2.0 should exercise the ns2.0 build)

Now if I use

dotnet test -f net46

I get 287 failures, all of the form:

System.BadImageFormatException : Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.0.19128.1, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' or one of its dependencies. An attempt was made to load a program with an incorrect format.

If I use:

dotnet test -f netcoreapp2.0

then it mostly works, but I get 10 failures that I need to investigate and look "real" but different - will log separately.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions