gpt4 book ai didi

c# - Visual Studio 无法写入输出文件 '...\obj\Debug\Foo.Bar.dll"

转载 作者:IT老高 更新时间:2023-10-28 11:19:42 24 4
gpt4 key购买 nike

我在 Visual Studio 2010 中编译大型 c# 解决方案时遇到此错误。每次编译后,我都必须删除此解决方案使用的一个项目的 obj 文件夹。否则我得到以下错误:

Could not write to output file '...\obj\Debug\Foo.Bar.dll'
The process cannot access the file because it is being used by another process

我一直在互联网上寻找解决方案,但实际上找到/尝试了其中的几个。

例如:开发论坛上的很多人建议不要在 UserControl(在其他一些来源 From)设计器打开时开始编译。

其他人使用 pre-build scripts 删除 obj 文件夹,这种特殊的解决方案是可以接受的,但如果发布的项目是一个广泛使用的库,它的重新编译将导致“父”项目的重新编译。

最佳答案

我终于找到了解决这个 VS2010(也是 SP1)“错误”的方法,我想与 stackoverflow 用户分享。

在我的情况下,问题在于 csproj 文件是自引用锁定的 '...\obj\Debug\Foo.Bar.dll' 文件。疯了我知道。所以我通过从 .csproj 文件中删除以下行来解决这个烦人的问题:

<Reference Include="Foo.Bar">
<HintPath>obj\Debug\Foo.Bar.dll</HintPath>
</Reference>

关于c# - Visual Studio 无法写入输出文件 '...\obj\Debug\Foo.Bar.dll",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12301625/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com