Visual Studio 2008将dll锁定在bin文件夹中,并且不会释放它 [英] Visual Studio 2008 locks dll in bin folder and doesn't let go of it

查看:87
本文介绍了Visual Studio 2008将dll锁定在bin文件夹中,并且不会释放它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个由8个.NET项目组成的解决方案.由于我正在练习TDD,因此我必须经常重新编译我的解决方案.最近,尝试进行编译时,我大约每隔第二次就会收到以下错误:

I am working on a solution consisting of 8 .NET projects. Since I am practicing TDD, I have to re-compile my solution very often. Lately I have been getting the following error about every second time when trying to compile:

错误2无法复制文件 将"obj \ Debug \ Zeiterfassung.Tests.dll"更改为 "bin \ Debug \ Zeiterfassung.Tests.dll". 进程无法访问文件 'bin \ Debug \ Zeiterfassung.Tests.dll' 因为它被另一个人使用 过程.

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

Zeiterfassung.Tests.dll是我的一个项目(它是单元测试项目)生成的dll.总是这个dll无法复制并导致错误.其他所有内容都可以在100%的时间内正常运行.

Zeiterfassung.Tests.dll is the dll generated by one of my projects (it's the unit testing project). It's always this dll that cannot be copied and causes the error. Everything else works fine 100% of the time.

大约9/10次后,我可以通过重新编译解决方案来解决"该问题.但是,当问题真的变得很严重时,无论我尝试多少次并且必须重新启动IDE,该项目都将无法成功编译.

In about 9/10 times I can "solve" the problem by recompiling my solution again. But when the problem is getting really bad, the project just won't compile successfully no matter how often I try and I have to restart the IDE.

我使用了Microsoft的handle.exe来确定哪个进程正在锁定DLL,并且它是devenv.exe.我还尝试过手动删除DLL,在重新启动IDE之前,它实际上是无法删除的.

I used microsoft's handle.exe to ascertain which process is locking the DLL and it is devenv.exe. I also tried deleting the DLL by hand and it really can't be deleted until I restart the IDE.

最后但并非最不重要的一点是,我尝试按照另一个论坛的建议将<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>添加到我的项目中,但这没有帮助.

Last but not least, I tried adding <GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies> to my project as suggested in another forum, but this did not help.

请帮助!这个问题真的开始使我发疯.

Please help! This problem is really starting to drive me nuts.

:我还可以补充一点,就是确保在发生此问题时我的单元测试已经完成.仍然,dll保持锁定状态.我正在通过Resharper单元测试资源管理器运行测试.

I might also add that I made sure my unit tests are finished when this problem occurrs. Still, the dll remains locked. I am running my tests via the Resharper unit test explorer.

推荐答案

在我移动测试项目,从存储库中检出该项目的较早版本并替换了所有项目之后,该错误消失了(手指交叉...)具有较新版本的代码文件.

Looks like the bug disappeared (fingers crossed...) after I moved my test project, checked out an earlier version of the project from the repository and replaced all code files with the newer versions.

这篇关于Visual Studio 2008将dll锁定在bin文件夹中,并且不会释放它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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