Dapper因.net 4.6而失败 - 无法加载文件或程序集

J K*_*ing 2 .net vb.net wpf mvvm-light dapper

我有一个针对.net 4.6和Dapper 1.50.4的WPF/MVVM Light应用程序我使用Visual Studio Pro 2017来开发应用程序

这个应用程序正在运行,但我有一台新计算机并将此应用程序的开发移至新计算机.当我尝试在我的新计算机上运行此应用程序时,我收到以下错误:

System.IO.FileLoadException: '无法加载文件或程序集'Dapper,Version = 1.50.4.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一.需要一个强名称的程序集.(来自HRESULT的异常:0x80131044)'

我试过了什么

  1. 我可以确认dapper.dll位于projectRoot/bin/debug目录中
  2. 我运行了程序集绑定日志查看器,运行我的应用程序时只出现一个错误,但它不在dapper.dll上,它位于system.windows.dll上:
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Users\jorda\...\bin\Debug\FTC_Application.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
 (Fully-specified)
LOG: Appbase = file:///C:/Users/jorda/.../bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = FTC_Application.exe
Calling assembly : GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\jorda\...\bin\Debug\FTC_Application.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: System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/jorda/.../bin/Debug/System.Windows.DLL.
LOG: Attempting download of new URL file:///C:/Users/jorda/.../bin/Debug/System.Windows/System.Windows.DLL.
LOG: Attempting download of new URL file:///C:/Users/jorda/.../bin/Debug/System.Windows.EXE.
LOG: Attempting download of new URL file:///C:/Users/jorda/.../bin/Debug/System.Windows/System.Windows.EXE.
LOG: All probing URLs attempted and failed.
Run Code Online (Sandbox Code Playgroud)
  1. 我已经卸载并重新安装了适合dapper的NuGet包
  2. 清除了我的项目中的obj文件夹以强制重建
  3. 该应用程序存在于一个驱动器文件夹中,因此我禁用了一个驱动器,认为同步进程可能已锁定文件,但这并没有解决问题.
  4. 显然重复重启Visual Studio
  5. 更新到最新版本的MVVM灯 - 没有变化

有些事情显然与将此解决方案移动到另一台计算机有关,但我不确定在哪里跟踪它.

有人可以帮我弄清楚为什么我在项目中调用dapper时遇到此错误,或者帮我修复它?

提前致谢

J K*_*ing 5

所以我没有意识到有一个强名称和非命名的dapper版本.事实是我对签署的集会不是很了解.

解:

  1. 删除普通的Dapper NuGet包
  2. 安装Dapper.StrongName NuGet包.

看到这个问题(信用)