问题描述
我有一个带有 NUnit 测试的 dll,它一直运行良好.我将它从 Any CPU 转换为 x86 项目,因为我需要在不同平台上可靠地使用 SQLite,所以我需要包含 32 位 System.Data.SQLite.dll 并让所有内容都引用它.
I have a dll with NUnit tests that had been working fine. I converted it from an Any CPU to an x86 project because I need to use SQLite reliably across different platforms, so I need to include the 32-bit System.Data.SQLite.dll and let everything reference that.
无论如何,转换后,NUnit 在尝试加载 dll 时会出现该错误.
Anyway, after conversion, NUnit gives that error when trying to load the dll.
我认为这根本没有启发性,但这是堆栈跟踪:
I don't think this will be enlightening at all, but here is the stack trace:
System.IO.FileNotFoundException: Could not load file or assembly ... or one of its dependencies. The system cannot find the file specified"
Server stack trace:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
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 NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.TestLoader.LoadTest(String testName)
我尝试测试的 dll 引用了同一解决方案中的另一个 dll.当我运行 GUI 时一切正常,这最终都会用到,但测试不会加载.
The dll I'm trying to test references another one in the same solution. Everything works fine when I run the GUI that this eventually all gets used in, but the tests won't load.
更新
无法加载的文件是被测程序集,也就是MyAppName.Test.dll.
The file that can't be loaded is the assembly under test, which is just MyAppName.Test.dll.
推荐答案
尝试使用 fusion log viewer fuslogvw.exe.它应该会为您提供有关问题的更多详细信息.
Try using the fusion log viewer fuslogvw.exe. It should give you more details about the problem.
这篇关于另一个“无法加载文件或程序集...或其依赖项之一.系统找不到指定的文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!