Error: "Spatial types and functions are not available for this provider"

I get an error message:

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

I get this error only on one of my development machines, and on the other it works correctly. Both machines have SQL Server 2014 on them, which should be enough, but apparently not. In addition, I installed the nuget package "Microsoft.SqlServer.Types" in the solution (I also tried it in several subordinate projects) and added the appropriate lines to load the corresponding DLL files:

Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

Debugging shows that the corresponding line is being executed and enters into it; it seems that the corresponding DLL files are loaded successfully.

The same computer that was used to start the project (a unit test) without errors. The error started to appear around the same time when I switched the test project to xUnit from MSTest, so it could very well be related to this.

Any suggestions for troubleshooting?

+4
source share
2 answers

FWIW, I eventually managed to get this work by including the highest level in this project, including unit tests, and DLL files using the method LoadNativeAssemblies, separately in each top-level project, including Microsoft.SqlServer.Types files. This was not taken into account in the documentation, but it was the only thing I could think of to work.

+3
source

Microsoft.SqlServer.Types 11.0.2 .

+2

Source: https://habr.com/ru/post/1622486/


All Articles