MoqRT 错误 - 创建时出现未处理的异常 MoqRT.Baked.dll

MoqRT Error - Unhandled Exception while Creating MoqRT.Baked.dll

我正在使用 VS2013 社区版、SQLite 并使用 MSTestFramework 创建了测试项目,其中我指的是用于创建模拟对象的 MoqRT 框架。

但是在创建模拟对象时出现如下错误,

Unhandled baking exception:  --> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'sqlite3': This operation is only valid in the context of an application container. (Exception from HRESULT: 0x8007109A)
   at SQLite.SQLite3.Open(String filename, IntPtr& db)
   at SQLite.SQLiteConnection..ctor(String databasePath)
   at MoqRT.Baking.BakingController.GetDatabase()
   at MoqRT.Baking.BakingController..ctor(String testAssembly, String appxPath, String bakingPath)
   at MoqRT.MoqRTRuntime.InitializeBaking(String testAssembly, String appxPath, String bakingPath)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at MoqRT.Baking.BakingWorkItem.Run(BakingContext context) in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingWorkItem.cs:line 35
   at MoqRT.Baking.BakingPoke.RunWorkItem(BakingController owner, WorkItem item) in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingPoke.cs:line 36
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at MoqRT.Baking.IBakingPoke.RunWorkItem(BakingController owner, WorkItem item)
   at MoqRT.Baking.BakingRunner.ThreadEntryPoint() in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingRunner.cs:line 55

我从 GitHub“/mbrit/moqrt”引用了项目和步骤 但无法创建 MoqRT.Baked.dll.

我在我的测试项目中引用了以下文件,

  1. MoqRT.MetroStyle.dll
  2. MoqRT.MetroStyle.pdb
  3. MoqRT.MetroStyle.pri

我也添加了图片供您参考。 提前致谢。 Unhandled Exception while Creating MoqRT.Baked.dll

我已通过从我的测试项目中删除与 MoqRT 版本 (SQLite3.dll) 使用的不同的 SQLite(对于 Windows 运行时)引用解决了这个问题。