简体   繁体   English

在Visual Studio中运行单元测试时出现FileLoadException

[英]FileLoadException when running unit tests in visual studio

I'm trying to run some unit tests in VS 2005 and keep getting the following error 我试图在VS 2005中运行一些单元测试,并不断收到以下错误

System.IO.FileLoadException: Could not load file or assembly
'Tests.CS.vs2005, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, ref StackCrawlMark stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, ref StackCrawlMark stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, ref StackCrawlMark stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at JetBrains.ReSharper.UnitTestProvider.nUnit.NUnitTaskRunner.GetType(IRemoteTaskServer server, RemoteTask fixture, String assemblyLocation, String typeName) in c:\Agent\work\e1023618541fdc56\src\UnitTestProvider.nUnit\src\NUnitTaskRunner.cs: line 539 at JetBrains.ReSharper.UnitTestProvider.nUnit.NUnitTaskRunner.Start(IRemoteTaskServer server, TaskExecutionNode node, NUnitTestFixtureTask fixture) in c:\Agent\work\e1023618541fdc56\src\UnitTestProvider.nUnit\src\NUnitTaskRunner.cs: line 353 at JetBrains.ReSharper.UnitTestProvider.nUnit.NUnitTaskRunner.Start(TaskExecutionNode node) in c:\Agent\work\e1023618541fdc56\src\UnitTestProvider.nUnit\src\NUnitTaskRunner.cs: line 26 at JetBrains.ReSharper.TaskRunnerFramework.CurrentAppDomainHost.Execute(TaskExecutionNode node) in c:\Agent\work\e1023618541fdc56\src\TaskRunnerFramework\src\Impl\CurrentAppDomainHost.cs: line 86

The assembly Tests.CS.vs2005 is the unit test's assembly from which the code is run. 程序集Tests.CS.vs2005是从中运行代码的单元测试程序集。 This is all set on a local vm while the source code is located on a shared folder from the host. 当源代码位于主机的共享文件夹中时,所有这些都在本地vm上设置。 I'm running ReSharper with VS and run the tests through it. 我正在使用VS运行ReSharper,并通过它运行测试。

Has anyone encountered this? 有人遇到过这个吗? I'm trying to find the config file that's suppose to contain the reference Tests.CS.vs2005, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null , my guess is this is a reference error related to the path to the host machine. 我正在尝试查找假定包含参考Tests.CS.vs2005,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = null的配置文件,我猜这是与主机路径相关的参考错误机。 Any thoughts on this are welcomed :) 欢迎对此有任何想法:)

Thanks! 谢谢!

If this is the type of error I think it is, it is usually caused by the previously built versions of the assembly files are locked by another process. 如果这是我认为的错误类型,则通常是由于先前构建的程序集文件版本被另一个进程锁定而引起的。 Try shutting down your other applications and see if it doesn't help. 尝试关闭其他应用程序,看看是否有帮助。 If you do it systematically, you should be able to figure out which one was the culprit. 如果系统地执行此操作,则应该能够找出是哪一个是罪魁祸首。

If that doesn't help, restart Visual Studio. 如果那没有帮助,请重新启动Visual Studio。

If that doesn't help either, reboot your computer :) 如果仍然不能解决问题,请重新启动计算机:)

If that doesn't help either, I'm out of ideas... 如果那也无济于事,我就没主意了...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio中运行应用程序时如何运行单元测试 - How to run unit tests when running the application in visual studio 是否有以编程方式运行Visual Studio单元测试的API? - Is there an API for running Visual Studio Unit Tests programmatically? Visual Studio 15.8.1 未运行 MS 单元测试 - Visual Studio 15.8.1 not running MS unit tests 单元测试Visual Studio - Unit Tests Visual Studio 在Visual Studio中调试单元测试时,是否可以动态地附加到正在运行的Web应用程序? - When debugging unit tests in Visual Studio, is there a way to dynamically attach to a running web application? 如何让Visual Studio单元测试将文件复制到测试区域? (在运行/调试时有效) - How to get Visual Studio Unit Test to copy a file to the tests area? (which works when running/debugging) 在 Visual Studio 中运行单元测试时出错:缺少测试用例对象 - Error when running unit tests in visual studio: Test-case objects missing 在Visual Studio(TDD)中构建和运行C ++单元测试 - Building and running C++ unit tests in Visual Studio (TDD) Visual Studio 2010在运行单元测试时引发异常 - Visual Studio 2010 throws exception on running unit tests 在 Visual Studio 中运行单元测试后如何播放声音 - How to play sound after running unit tests in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM