gpt4 book ai didi

c# - Visual Studio 2017 无法复制 dll,因为它正被 MSBuild.exe 进程使用

转载 作者:太空宇宙 更新时间:2023-11-03 22:54:22 25 4
gpt4 key购买 nike

我有一个包含 2 个项目的解决方案:一个 WPF Applicatin 和一个 ClassLibrary(尝试了 Standard 和 Framework 模板)。 WPFApp 引用 ClassLibrary。

问题是:当我尝试构建解决方案时出现以下错误:

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

如果我结束 MSBuild.exe 进程,一切正常(直到我更改 ClassLibrary 上的某些内容并尝试构建解决方案)

我尝试了构建前和构建后的事件

taskkill /F /IM MSBuild.exe

但是它不起作用,只是出现了一些新的错误。我猜这是因为 MSBuild 关闭了它。

您是否知道如何处理该问题或至少出现此类 MSBuild 行为的原因是什么?

最佳答案

似乎是 FodyWeaver 导致了这个问题。

引自 the project page on GitHub :

Not Supported:

[...]

我认为 Fody 只是搞砸了构建过程。也许它执行类似于构建任务的操作(如@Crowcoder 所建议的那样),因此 MSBuild 锁定了 dll。

切换回packages.config后问题消失了。

关于c# - Visual Studio 2017 无法复制 dll,因为它正被 MSBuild.exe 进程使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46104529/

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