This has been asked many times, however after following the advice in this answer I am still coming up short.
I have a class library that gets invoked by another app. This works locally without issue. I use the following...
SqlServerSpatial140
and msvcr120
are both in the bin in their respective folders.
Before spatial calls are invoked
SqlServerTypes.Utilities.LoadNativeAssemblies(dlls); // dlls == bin directory
SqlProviderServices.SqlServerTypesAssemblyName = typeof(SqlGeography).Assembly.FullName;
App.config
<runtime>
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
</runtime>
However when deployed onto a server I get a System.InvalidOperationException
when calling System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText)
with 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. System.InvalidOperationException: Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.
What am I missing here?