在visual studio中运行单元测试时出现FileLoadException

时间:2009-11-25 15:20:06

标签: visual-studio unit-testing resharper

我正在尝试在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

程序集 Tests.CS.vs2005 是运行代码的单元测试程序集。这是在本地vm上设置的,而源代码位于主机的共享文件夹中。我正在使用VS运行ReSharper并通过它运行测试。

有没有人遇到过这个?我试图找到配置文件,假设包含引用 Tests.CS.vs2005,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = null ,我的猜测是这是一个引用错误与主机的路径有关。欢迎任何想法:)

谢谢!

1 个答案:

答案 0 :(得分:1)

如果这是我认为的错误类型,它通常是由以前构建的版本的程序集文件被另一个进程锁定引起的。尝试关闭其他应用程序,看看它是否没有帮助。如果你系统地做,你应该能够弄清楚哪一个是罪魁祸首。

如果这没有帮助,请重新启动Visual Studio。

如果这也没有帮助,请重新启动计算机:)

如果这也没有帮助,我就没有想法......