VS.NET 里面编译时DLL被占用了,怎么办呢?

来源:互联网 发布:linux 修改文件夹名称 编辑:程序博客网 时间:2024/06/04 18:25

因为开发习惯,通常都会把开发过程中一些库文件生成到同一个目录Library。不过最近发现一个问题,我在一个Solution里面同时包含了几个库文件的project,每次编译的时候VS.NET都会抛出一个错误,说"XXX.dll"正在被使用,不能拷贝到本地。搞了半天把project里面的属性都设了一次,还是没搞定。因为这几个库文件之间会有一个引用关系,所以就怀疑VS.NET自己将这个DLL Load到内存里面了。狂骂一通Microsoft的Bug。但是今天好好查了一下MSDN发现原来不是这样子的。MSDN上提到"

There may be a problem associated with building projects into the same output directory. In this case, build the two projects to different directories. When building into different directories, the project system copies all dependent assemblies into a project's output directory.

"

看了这个恍然大悟,原来是自己开发习惯的问题。不过还是要骂一句Microsoft.因为它的错误信息让我想错了问题,也跑了偏路来找问题的解决办法。

   后来把被引用的Project文件生成到另外一个路径下面就没问题了。