Skip to content

Microsoft.SqlServer.Types hardcoded to use 10.0 or 11.0 #244

@danmiser

Description

@danmiser

On a new machine I have VS2017 and MSSQL2016 installed. I create a project that installs EntityFramework 6.1.3 and Microsoft.SqlServer.Types 14.0.314.76 and uses spatial types. When running, you get the error:
"Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found"

The workaround is to set up a binding redirect to point from version 10.0.0.0 to version 14.0.0.0.

Further analysis:
In System.Data.Entity.SqlServer, the ctor for SqlTypesAssemblyLoader defaults to hardcoded assembly version checks of version 10.0 or 11.0 of Microsoft.SqlServer.Types.dll.

This check is problematic as the pace of release of EF is much slower than the pace of release of the Microsoft.SqlServer.Types nuget package [1]. I would think that the installation of the nuget package should do 1 of 2 things:

  1. Create the binding redirect for you when installing the nuget package in the app/web.config. This would ensure things are always pointing to the latest and proper version.
  2. Use the Loader.cs class to specify the currently installed version to pass in to SqlTypesAssemblyLoader.

[1] https://www.nuget.org/packages/Microsoft.SqlServer.Types/

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions