‘Microsoft.SqlServer.Types’ version 10 or higher could not be found

If you have a connection to SQL Server where you’re using spatial types with Entity Framework, and deploying to an Azure service/server, you’re likely to come across the exception:

Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.

While you can install SQL Server, a far easier way around it is to install the NuGet package Microsoft.SqlServer.Types.

After you install that NuGet package, you’ll want to make a call to SqlServerTypes.Utilities.LoadNativeAssemblies prior to any actual calls in Entity Framework.

ASP.NET (e.g. in Global.asax.cs -> Application_Start)

Standalone Application

Additionally, in the current versions of Entity Framework, there is a hardcoded reference to only look for versions 10 and 11 of the Microsoft.SqlServer.Types assembly. You can fix this by doing the following in code (the version number should match the version you’re using via the NuGet package above):

The final version:


Standalone Application: