nunit 锁定 dll [英] nunit locking dll

查看:42
本文介绍了nunit 锁定 dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 windows 7 64 位电脑上使用带有 Visual Studio 2010 的 nunit.

I have been using nunit with visual studio 2010 on a windows 7 64-bit pc.

我可以打开 nunit gui 并运行我的单元测试.如果我随后更改其中一个单元测试并尝试重建,则会收到如下文件锁定错误 -

I am able to open the nunit gui and run my unit tests. If I then change one of the unit tests and try to rebuild, I am getting a file locking error as follows -

错误 1 ​​无法将文件obj\Debug\myProject.Tests.dll"复制到bin\Debug\myProject.Tests.dll".进程无法访问文件'bin\Debug\myProject.Tests.dll' 因为它正在被另一个使用过程.myProject.Tests

Error 1 Unable to copy file "obj\Debug\myProject.Tests.dll" to "bin\Debug\myProject.Tests.dll". The process cannot access the file 'bin\Debug\myProject.Tests.dll' because it is being used by another process. myProject.Tests

我已经使用进程资源管理器来验证锁定 dll 的是 nunit-agent.exe.

I have used process explorer to verify that it is the nunit-agent.exe that is locking the dll.

我通过工具 > 测试程序集注意到 nunit.exe 在 clr 版本 Net 2.0 下运行,而 nunit-agent.exe 在 clr 版本 Net 4.0 下运行.这可能与问题有关吗?如果是这样,我该如何解决?如果没有,有人知道还会发生什么吗?

I have noticed via tools > test assemblies that the nunit.exe is running under clr version Net 2.0 and nunit-agent.exe is running under clr version Net 4.0. could that have something to do with the problem? If so, how can I fix it? If not, does anyone have any idea what else may be going on?

感谢您的任何想法.

推荐答案

我认为这与我的测试项目的位置有关.最初,我将 nunit 测试项目放在与我的 dll 文件不同的目录中.我想我会把我所有的测试项目放在一个集中的位置.

I think this has to do with the placement of my test project. Initially, I was putting the nunit test project in a seperate directory from my dll files. I was thinking that I would keep all of my test projects in one centralized location.

我将我的测试项目移动到与我的 Visual Studio 项目下的测试 dll 相同的位置.之后,它似乎工作正常.

I them moved my test project into the same location as my test dlls under my visual studio projects. After that, it seems to be working correctly.

我认为这必须做卷影副本.我在 google 上的 nunit 组中读到,.net 框架只会对应用程序库或其子目录中的程序集进行影子复制.

I think this has to do the shadow copy. I read in the nunit group on google that the .net framework will only shadow copy assemblies in the application base or it's subdirectories.

这促使我尝试在我的应用程序库中创建 nunit 测试项目,这似乎有效.

This led me to try creating the nunit test project within my application base and that seemed to work.

希望这是有道理的.

谢谢

这篇关于nunit 锁定 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆