简体   繁体   中英

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

I'm getting 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.

I'm only getting this error on one of my dev machines - on the other, it works correctly. Both machines have SQL Server 2014 installed on them, which ought to be enough, but apparently it's not. Beyond that, I've installed the nuget package "Microsoft.SqlServer.Types" in the solution (I've tried it in several of the subordinate projects as well), and have added the appropriate lines to load the DLLs in question:

Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

Debugging shows that the line in question executes, and stepping into it, it appears that the DLLs in question load successfully.

The same machine used to run the project (a unit test assembly) without errors. The error started showing up about the same time that I switched the test project over to xUnit from MSTest, so it may very well be related to that.

Any suggestions for troubleshooting this?

FWIW, I eventually managed to get this working by including the Microsoft.SqlServer.Types in every top-level project, including unit tests, and loading the DLLs via the LoadNativeAssemblies method separately in each top-level project. The documentation made no note of this, but it was the only thing I could come up with that worked.

降级到Microsoft.SqlServer.Types版本11.0.2对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM