【问题标题】:Cannot run mspec.exe with Syste.Data.SQLite.dll x86, but it works in R# MSpec runner无法使用 Syste.Data.SQLite.dll x86 运行 mspec.exe,但它适用于 R# MSpec runner
【发布时间】:2010-09-26 11:58:06
【问题描述】:

我使用 mspec 进行测试,并在测试中为我的数据库使用 SQLite x86 的 NHiernate 设置。问题是,当我使用 mspec r# runner 运行我的测试时,一切正常,但是从控制台运行它会出现一个错误,它无法找到 sqlite dll。

我的规范项目配置:

.net 4

x86(使用 x86 版本的 sqlite)

System.Data.SQLite,版本=1.0.64.0,文化=中性,PublicKeyToken=db937bc2d44ff139 mspec,Version=0.3.0.0,Culture=neutral,PublicKeyToken=null,目标运行时:v4.0.30319,目标:x86

MSpec 是从源代码构建的。在 Reflector 中,mspec.exe 显示为为 x86 构建的 - 这似乎适合我的设置,并且使用 r# runner 测试运行良好。

NHibernate.HibernateException:无法从 NHibernate.Driver.SQLite20Driver 创建驱动程序,NHibernate,版本=2.1.2.4000,文化=中性,PublicKeyToken=aa95f207798dfdb4。 ---> System.Reflection.TargetInvocationException:调用的目标已抛出异常。 ---> NHibernate.HibernateException:找不到程序集 System.Data.SQLite 中的 IDbCommand 和 IDbConnection 实现。确保程序集 System.Data.SQLite 位于应用程序目录或全局程序集缓存中。如果程序集在 GAC 中,请使用应用程序配置文件中的元素来指定程序集的全名。 在 NHibernate.Driver.ReflectionBasedDriver..ctor(字符串 driverAssemblyName,字符串 connectionTypeName,字符串 commandTypeName) 在 NHibernate.Driver.SQLite20Driver..ctor()

有人知道如何解决这个问题吗?

提前感谢多云维也纳的问候,

克里斯

【问题讨论】:

  • 发布 exact 异常消息。使用 fuslogvw.exe 解决程序集解析问题。
  • 这是堆栈跟踪中的相关部分

标签: .net sqlite resharper mspec


【解决方案1】:

使用 fuslogvw.exe 我发现了实际错误(感谢提示;): “拒绝针对 v2.0.50727 构建的 IJW 模块,因为它可以在此过程中加载到另一个运行时。”

添加一个 mspec.exe.config 像:

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true" ></startup>
</configuration>

解决了这个问题,现在我的测试运行符合预期。

感谢和问候,

克里斯

【讨论】:

    猜你喜欢
    • 2013-10-28
    • 2013-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-01
    • 2019-09-09
    • 2023-04-10
    相关资源
    最近更新 更多