因为星期天我有以下例外:
System.IO.FileLoadException:'无法加载文件或程序集 '基础设施,版本= 1.0.6561.42339,文化=中立, PublicKeyToken = 9beef0ff5a4acdf8'或其依赖项之一。该 找到程序集的清单定义与程序集不匹配 参考。 (HRESULT异常:0x80131040)'
Fusion Log:
*** Assembly Binder Log Entry (10.04.2018 @ 15:56:06) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\projectsTFS\MyApp\Source\MyApp\MyApp\bin\x64\Debug\MyApp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Infrastructure, Version=1.0.6561.42339, Culture=neutral, PublicKeyToken=9beef0ff5a4acdf8
(Fully-specified)
LOG: Appbase = file:///C:/projectsTFS/MyApp/Source/MyApp/MyApp/bin/x64/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApp.exe
Calling assembly : EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\projectsTFS\MyApp\Source\MyApp\MyApp\bin\x64\Debug\MyApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Infrastructure, Version=1.0.6561.42339, Culture=neutral, PublicKeyToken=9beef0ff5a4acdf8
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/projectsTFS/MyApp/Source/MyApp/MyApp/bin/x64/Debug/Infrastructure.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\projectsTFS\MyApp\Source\MyApp\MyApp\bin\x64\Debug\Infrastructure.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Infrastructure, Version=1.0.6674.28044, Culture=neutral, PublicKeyToken=9beef0ff5a4acdf8
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
当我想通过实体框架(6.2)
访问数据库时出现第一次使用数据库是代码首次迁移:
//Migrator checking the current UpdateState and log the currently pending migrations
DbMigrator mig = new DbMigrator(new Configuration());
foreach (var migration in mig.GetPendingMigrations())
{
_logger.Log("Open Migration: " + migration, Category.Debug, Priority.None);
}
_logger.Log("Start Migrations", Category.Debug, Priority.None);
//Initialize the Database and Update it
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DatabaseContext, Configuration>());
// To run Seed method
mig.Update(); // X <-- ERROR
当我跳过代码第一次迁移时,错误发生在数据库的第一个选择上。
这发生在'DatabaseModule'中,主应用程序使用prism mef加载。所有(33)项目都引用了基础设施项目(直接而不是dll)。
我所看到的:
版本6561来自~2017.12.18,也是(偶然?)上次迁移的日期。版本6674是从今天2018.04.10开始的最新版本。其他(Sub)命名空间,如Infrastructure.XmlSerializers或Infrastructure.resources,从实际版本中使用,显示在程序集绑定日志查看器(fuslogvw.exe)中。
当我从没有Visual Studio的Debug文件夹启动direclty时,应用程序启动时没有错误。
环境:
到目前为止我尝试了什么:
我的想法已经不多了。有人可以帮忙吗?
期待新的想法, 马可
答案 0 :(得分:0)
经过更长时间的调查并深入了解项目的清单/参考资料后,我使用AsmSpy来获取更复杂的依赖项列表。
asmspy c:\projectsTFS\MyApp\Source\MyApp\MyApp\bin\x64\Debug\ -a -s -b -i
并得到一些错误。但大多数错误来自系统引用,如:
其他人看起来更具有针对性,因为它们被基础设施引用:
此后我更新了大部分NuGet包。
之后,错误仍然存在,但我可以跳过它们,解决方案正常开始!
至少我检查&#34;选项&gt;调试&gt;一般&gt;启用Just My Code&#34;而且我再也看不到错误了。