ASP.NET Core中的Microsoft.SqlServer.Types [英] Microsoft.SqlServer.Types in ASP NET Core

查看:172
本文介绍了ASP.NET Core中的Microsoft.SqlServer.Types的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取nuget包Microsoft.SqlServer.Types以在针对完全框架461的ASP Core中工作。我需要使用SqlGeography和SqlHierarchyId类型。但是,当我运行测试时,出现以下错误无法加载DLL SqlServerSpatial140.dll 。我知道安装软件包时,可以在.nuget\packages\microsoft.sqlserver.types\14.0.314.76\nativeBinaries\文件夹中找到dlls文件。

I'm trying to get the nuget package Microsoft.SqlServer.Types to work in ASP Core targeting full framework 461. I need to use the types SqlGeography and SqlHierarchyId. But when I run my test I get following error 'Unable to load DLL SqlServerSpatial140.dll'. I know when the package is installed the dlls file can be found in the .nuget\packages\microsoft.sqlserver.types\14.0.314.76\nativeBinaries\ folder.

但是如何以最佳方式将dll包含在解决方案中?

我希望更新软件包时更新dll。该路径不能硬编码为特定的用户路径,它必须适用于每个PC设置。

I would like the dlls to be updated when the package is updated. The path can not be hardcode to a specific user path, it has to work on every pc setup.

推荐答案

有一个自述文件Microsoft.SqlServer.Types Nuget包附带的.htm文件。它将说明如何加载所需的本机dll文件。
基本上,您需要在代码中调用此行:

There is a readme.htm file included with the Microsoft.SqlServer.Types Nuget package. It will explain how to load the needed native dll files. Basically you need to call this line in your code:

SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

这篇关于ASP.NET Core中的Microsoft.SqlServer.Types的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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