研究员,
我在开发环境中遇到了问题。 我创建了一个使用EntityFramework和ASP.NET Identity的项目,然后创建了一些其他项目,如WCF服务和WebForms站点引用第一个项目。 项目编译和工作正常,但当我尝试使用" Update-Database"在程序包管理器控制台中更新我启用迁移的数据库:
System.Data.Entity.Core.MetadataException:指定的架构不是 有效。错误:(0,0):错误0004:无法加载文件或程序集 ' Microsoft.AspNet.Identity.EntityFramework,Version = 1.0.0.0, Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其中一个 依赖。定位程序集的清单定义没有 匹配程序集引用。 (HRESULT异常:0x80131040)
我在每个项目中引用的Microsoft.AspNet.Identity.EntityFramework的版本是2.0.0.0(我在某些时候用NuGet升级了它)。如何找出谁正在寻找旧版本并解决该问题?
我已经尝试了以下步骤:
在Visual Studio中手动检查每个项目的引用。他们都有 正确的版本(2.0.0.0)和指定的DLL路径和"具体 版本"属性设置为"错误"。
清除"临时ASP.NET文件"在我的AppData和C:\ Windows ...
当然清除了整个解决方案(删除了bin& obj文件夹)
手动检查每个* .csproj文件是否存在无效引用
使用NuGet重新安装软件包(Update-Package -includePrerelease -reinstall)
在每个App.config / Web.config中包含程序集绑定重定向:
<runtime> <assemblyBinding> <dependentAssembly> <assemblyIdentity name="Microsoft.AspNet.Identity.EntityFramework" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime>
*** Assembly Binder Log Entry (2014-04-18 @ 01:10:23) *** The operation failed. Bind result: hr = 0x80131040. No description available. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/Developer/sharp/projects/ShadowServer/DataModel/bin/Debug/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Developer\sharp\projects\ShadowServer\DataModel\tmp2BEF.tmp LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL file:///C:/Developer/sharp/projects/ShadowServer/DataModel/bin/Debug/Microsoft.AspNet.Identity.EntityFramework.DLL. LOG: Assembly download was successful. Attempting setup of file: C:\Developer\sharp\projects\ShadowServer\DataModel\bin\Debug\Microsoft.AspNet.Identity.EntityFramework.dll LOG: Entering download cache setup phase. LOG: Assembly Name is: Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: The assembly reference did not match the assembly definition found. ERR: Setup failed with hr = 0x80131040. ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
提前抱歉我的英语:)
答案 0 :(得分:0)
在我的情况下,我收到以下错误:
无法加载文件或程序集'Microsoft.AspNet.Identity.EntityFramework,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。
我意识到我的主要UI启动项目有旧版本的Microsoft.AspNet.Identity.EntityFramework 默认情况下 ...(而在另一个数据层项目中我手动获取了最新的库)所以刚刚从NUGet更新了主要项目。