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

本小妞迷上赌 提交于 2019-12-23 15:29:43

问题


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?


回答1:


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.




回答2:


Downgrading to Microsoft.SqlServer.Types Version 11.0.2 worked for me.



来源:https://stackoverflow.com/questions/34561891/error-spatial-types-and-functions-are-not-available-for-this-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!