无法找到程序集“Microsoft.SqlServer.Types”版本10或更高版本
我有个问题。 我无法将迁移添加到我的ASP.NET WebAPI 2项目中。 我收到错误:
“此提供程序无法使用空间类型和函数,因为无法找到程序集”Microsoft.SqlServer.Types“版本10或更高版本。”
我知道有几个问题和答案,如:
- 在Azure上找不到“Microsoft.SqlServer.Types”版本10或更高版本
- 在ASP.NET中将字符串转换为DbGeometry时出现“空间类型和函数不可用”错误
但! 问题是…
- 我已经安装了Microsoft.SqlServer.Types。
- 我已经将Global.asax配置为: SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath(“〜/ bin”))到Application_Start中。
- 引用设置为本地副本> true。
- NuGet包都已更新。
- 我已经尝试降级并升级包。
当我尝试运行Add-Migration v002时,这是完整的错误:
System.InvalidOperationException:此提供程序无法使用空间类型和函数,因为无法找到程序集“Microsoft.SqlServer.Types”版本10或更高版本。
zh_cn System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()zh_cn System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(String wellKnownText)zh_cn System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText)zh_cn System.Data .Entity.Migrations.Model.ColumnModel.CreateDefaultValue()
zh_cn System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind type,TypeUsage typeUsage)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty属性,TypeUsage conceptualTypeUsUsage,TypeUsage defaultStoreTypeUsage,IDictionary2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, ModelMetadata modelMetadata, IDictionary
2 annotations)
en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer。 c__DisplayClass2e3.b__2df(EdmProperty p)zh_cn System.Data.Entity.Utilities.IEnumerableExtensions.Each [T](IEnumerable1 ts, Action
1 action)zh_cn System.Data .Entity.Migrations.Infrastructure.EdmModelDiffer.BuildCreateTableOperation(EntitySet entitySet,ModelMetadata modelMetadata)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.b__194(EntitySet es)zh_cn System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
en System.Collections.Generic.List2.MoveNext()
en System.Collections.Generic.List2.MoveNext()
1..ctor(IEnumerable
en System.Collections.Generic.List1 collection)
en System.Linq.Enumerable.ToList[TSource](IEnumerable1 collection)
en System.Linq.Enumerable.ToList[TSource](IEnumerable1 collection)
1 source)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(ModelMetadata source,ModelMetadata target,Lazy
en System.Linq.Enumerable.ToList[TSource](IEnumerable1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy
1 modificationCommandTreeGenerator,MigrationSqlGenerator migrationSqlGenerator,String sourceModelVersion,String targetModelVersion)zh_cn System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace,Boolean ignoreChanges)zh_cn System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName,Boolean ignoreChanges)zh_cn System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder scaffolder)zh-cn System。 Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()zh System.AppDo main.DoCallBack(CrossAppDomainDelegate callBackDelegate)zh_cn System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
zh_cn System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)zh_cn System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName,String language,String rootNamespace,Boolean ignoreChanges)zh_cn System.Data。 Entity.Migrations.AddMigrationCommand.Execute(String name,Boolean force,Boolean ignoreChanges)zh_cn System.Data.Entity.Migrations.AddMigrationCommand。 c__DisplayClass2。 b__0()zh_cn System.Data.Entity.Migrations.MigrationsDomainCommand。执行(动作命令)
经过大量研究后,我刚从以下位置安装了“SQL Server 2012的Microsoft System CLR类型”:
- X86 – http://go.microsoft.com/fwlink/?LinkID=239643&clcid=0x409
- X64 – http://go.microsoft.com/fwlink/?LinkID=239644&clcid=0x409
像魅力一样工作!
确保您没有错过绑定重定向
问题可能是“虚拟”。 在发出add-migration命令时,您需要在bin文件夹中包含SqlServerSpatial140.dll。 只需将.dll复制到bin以进行开发,并在部署期间手动替换版本(x86 / x64)。 Sql Server(2012+)已经安装了程序集。
这对我有用。
将其添加到web.config> system.webServer >> runtime >> assemblyBinding节点
- Mongo DB对象Id使用JSON序列化程序进行反序列化
- 访问Azure Service Fabric状态服务状态
- 如何使用OAuth 2.0对Azure Active Directory进行身份validation?
- 强制EventProcessorHost将失败的Azure Event Hub eventData重新传递给IEventProcessor.ProcessEvents方法
- 连续Azure WebJob何时停止NoAutomaticTrigger类型作业的通知
- 检索使用C#.NET链接到Windows Azure网站的SQL Azure数据库的连接字符串
- 如何使用Azure流畅的资源管理注册资源提供程序?
- 使用Windows Azure DiagnosticsMonitor时,log4net traceappender仅记录级别为“详细”的消息
- 如何在没有登录的情况下使用window azure media server的文件路径阻止播放video?