“文件正由另一个进程使用”错误 [英] "File is being used by another process" error

查看:180
本文介绍了“文件正由另一个进程使用”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助来追踪此错误。

I need some help tracking down this error.

"无法复制文件XXXX。 DLL。该进程无法访问文件XXX.dll,因为它正由另一个进程使用。"

"Unable to copy file XXXX.dll. The process cannot access the file XXX.dll because it is being used by another process."

当我尝试构建项目XXX(在Visual Studio中)时发生错误。似乎文件被Visual Studio本身锁定。

The error occurs when I try to build  project XXX (within Visual Studio). It appears that the file is being locked by Visual Studio itself.

我不能总是重新创建它,但是当我使用我开发的创建XXX.dll实例的组件时,它似乎发生了。使用组件后,有时会出现此错误。大部分时间没有问题,但有时候,如果我的组件产生异常,则会特别。

I cannot always recreate it but it appears to happen when I use a component I developed that creates instances of XXX.dll. After I use the component this error occurs sometimes. Most of the time there is not a problem, but sometimes it is, particulary if my component generates an exception.

所以步骤似乎是。

Component从输出目录动态加载XXX.dll。然后我使用Visual Studio修改XXX.dll并重新编译它。 Visual Studio尝试将XXX.dll复制到输出目录。复制命令不能替换它认为正被另一个进程使用的DLL。但是这个过程就是Visual Studio本身。

Component dynamically loads XXX.dll from the output directory. I then use Visual Studio to modify XXX.dll and recompile it. Visual Studio tries to copy XXX.dll to the output directory. The copy command cannot replace the dll becuase it thinks it is being used by another process. But that process is Visual Studio itself.

我想知道MSBuild是否在与Visual Studio相同的进程空间中运行,更常见的是会导致此错误发生的原因是什么? Visual Studio在执行用户程序时显然会一直加载和运行dll,并且不会发生此错误。我听说有时候你需要使用影子复制dll才能解决这个问题。

I was wondering if MSBuild runs in the same process space as Visual Studio and more generally what would cause this error to occur? Visual studio obviously loads and runs dlls all the time when it executes a user program and this error does not occur. I have heard that sometimes you need to shadow copy dlls in order to get around this.

谢谢,

Joe

推荐答案

嗨Joe,

如果您使用的是Visual Studio 2003,则以下内容可能存在密切关系。

If you are using Visual Studio 2003, the following might be germane.

http://support.microsoft.com/kb/887818/

我在很长一段时间内没有遇到过这个问题,但我似乎还记得VS 2003中的一个CopyLocal属性,你也可以使用它来帮助防止出现这种错误。

I haven't run across this in quite a while myself, but I seem to recall a CopyLocal property in VS 2003 that you could also use to help prevent this sort of error.

此致,


这篇关于“文件正由另一个进程使用”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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