错误:“此提供程序无法使用空间类型和功能"; [英] Error: "Spatial types and functions are not available for this provider"

查看:35
本文介绍了错误:“此提供程序无法使用空间类型和功能";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了错误:

该提供者无法使用空间类型和功能,因为找不到程序集"Microsoft.SqlServer.Types" 10或更高版本.

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

我只在一台开发机上遇到此错误-在另一台上,它可以正常工作.两台计算机上均已安装SQL Server 2014,这应该足够,但显然并非如此.除此之外,我还在解决方案中安装了nuget包"Microsoft.SqlServer.Types"(我也在多个下级项目中进行了尝试),并添加了相应的行来加载有问题的DLL:

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);

调试显示相关行已执行,并进入该行,看来相关DLL已成功加载.

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

用于运行项目(单元测试程序集)的同一台机器没有错误.在我将测试项目从MSTest切换到xUnit的大约同一时间开始出现该错误,因此很可能与此有关.

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,我最终通过在每个顶级项目(包括单元测试)中包含Microsoft.SqlServer.Types并通过每个顶级项目中分别使用 LoadNativeAssemblies 方法.文档没有对此进行说明,但这是我唯一能想到的方法.

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.

这篇关于错误:“此提供程序无法使用空间类型和功能";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆