找不到程序集"Microsoft.SqlServer.Types" 10或更高版本 [英] Assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found

查看:640
本文介绍了找不到程序集"Microsoft.SqlServer.Types" 10或更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题.我无法向我的ASP.NET WebAPI 2项目添加迁移.我收到错误消息:

I Have a problem. I'm not able to add a Migration to my ASP.NET WebAPI 2 Project. I get error:

此提供程序无法使用空间类型和功能 因为程序集'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."

我知道对此有一些疑问和答案,例如:

I know there are several questions and answers about this, like:

  • 'Microsoft.SqlServer.Types' version 10 or higher could not be found on Azure
  • "Spatial types and functions are not available" error when converting a string to DbGeometry in ASP.NET

但是!问题是...

  • 我已经安装了Microsoft.SqlServer.Types.
  • 我已经将Global.asax配置为: SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath(〜/bin"))到Application_Start中.
  • 参考设置为本地副本> true.
  • NuGet软件包都已更新.
  • 我已经尝试降级和升级该软件包.
  • I already have installed Microsoft.SqlServer.Types.
  • I already have Global.asax configured with: SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin")) into the Application_Start.
  • Reference is set to local copy > true.
  • NuGet packages are all updated.
  • I already try to downgrade and upgrade the package.

这是我尝试运行的完整错误,例如添加迁移v002 :

This is the full error when I try to run for example Add-Migration v002:

System.InvalidOperationException:空间类型和函数不是 可用于此提供程序,因为程序集 找不到'Microsoft.SqlServer.Types'版本10或更高版本.
恩 System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly() 恩 System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(字符串 wellKnownText)zh System.Data.Entity.Spatial.DbGeography.FromText(字符串wellKnownText) 恩 System.Data.Entity.Migrations.Model.ColumnModel.CreateDefaultValue()
恩 System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind type,TypeUsage typeUsage)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty 属性,TypeUsage conceptTypeUsage,TypeUsage defaultStoreTypeUsage,IDictionary 2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, ModelMetadata modelMetadata, IDictionary 2个注释)
恩 System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.<> c__DisplayClass2e3.b__2df(EdmProperty 钢笔 System.Data.Entity.Utilities.IEnumerableExtensions.Each [T](IEnumerable 1 ts, Action 1操作) System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildCreateTableOperation(EntitySet entitySet,ModelMetadata modelMetadata)zh-cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.b__194(EntitySet es)zh System.Linq.Enumerable.WhereSelectEnumerableIterator 2.MoveNext()
en System.Collections.Generic.List
1..ctor(IEnumerable 1 collection)
en System.Linq.Enumerable.ToList[TSource](IEnumerable
1源)zh-cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(ModelMetadata 源,ModelMetadata目标,Lazy 1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy 1 modifyCommandTreeGenerator,MigrationSqlGenerator migrationSqlGenerator,字符串sourceModelVersion,字符串 targetModelVersion)zh System.Data.Entity.Migrations.DbMigrator.Scaffold(字符串 migrationName,字符串名称空间,布尔值ignoreChanges) System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(字符串 migrationName,布尔值ignoreChanges) System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder 脚手架)zh System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run() zh-cn System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)zh System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
zh-cn System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner 亚军)zh System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(字符串 migrationName,字符串语言,字符串rootNamespace,布尔值 ignoreChanges)zh System.Data.Entity.Migrations.AddMigrationCommand.Execute(字符串名称, 布尔值强制,布尔值ignoreChanges)zh_cn System.Data.Entity.Migrations.AddMigrationCommand.<> c__DisplayClass2.< .ctor> b__0() 恩 System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(操作 命令)

System.InvalidOperationException: Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.
en System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly() en System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(String wellKnownText) en System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText) en System.Data.Entity.Migrations.Model.ColumnModel.CreateDefaultValue()
en System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind type, TypeUsage typeUsage) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, TypeUsage conceptualTypeUsage, TypeUsage defaultStoreTypeUsage, IDictionary2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, ModelMetadata modelMetadata, IDictionary2 annotations)
en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.<>c__DisplayClass2e3.b__2df(EdmProperty p) en System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable1 ts, Action1 action) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildCreateTableOperation(EntitySet entitySet, ModelMetadata modelMetadata) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.b__194(EntitySet es) en System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
en System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
en System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(ModelMetadata source, ModelMetadata target, Lazy1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion) en System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace, Boolean ignoreChanges) en System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName, Boolean ignoreChanges) en System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder scaffolder) en System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run() en System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) en System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
en System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) en System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges) en System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges) en System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0() en System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

推荐答案

经过大量研究,我从以下位置安装了"SQL Server 2012的Microsoft System CLR类型":

After a lot of research I just installed "Microsoft System CLR Types for SQL Server 2012" from:

  • X86 - http://go.microsoft.com/fwlink/?LinkID=239643&clcid=0x409
  • X64 - http://go.microsoft.com/fwlink/?LinkID=239644&clcid=0x409

像魅力一样工作!

这篇关于找不到程序集"Microsoft.SqlServer.Types" 10或更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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