Visual Studio 2017 无法复制 dll,因为它正被 MSBuild.exe 进程使用
Visual Studio 2017 could not copy dll, because it's being used by MSBuild.exe process
我有一个包含 2 个项目的解决方案:一个 WPF Applicatin
和一个 ClassLibrary
(尝试了标准和框架模板)。 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 上的某些内容并尝试构建解决方案)
我尝试使用
进行预构建和 post-构建事件
taskkill /F /IM MSBuild.exe
但是它不起作用,只是出现了一些新错误。我猜这是因为 MSBuild 关闭了它。
您是否知道如何处理该问题,或者至少知道此类 MSBuild 行为的原因是什么?
问题似乎是 FodyWeaver 造成的。
Not Supported:
[...]
- Projects mixing the old .csproj format with new
<PackageReference>
nodes.
我认为 Fody 只是搞砸了构建过程。也许它执行类似于构建任务的操作(如@Crowcoder 所建议的那样),因此 MSBuild 锁定了 dll。
切换回 packages.config
后问题消失了。
我有一个包含 2 个项目的解决方案:一个 WPF Applicatin
和一个 ClassLibrary
(尝试了标准和框架模板)。 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 上的某些内容并尝试构建解决方案)
我尝试使用
进行预构建和 post-构建事件taskkill /F /IM MSBuild.exe
但是它不起作用,只是出现了一些新错误。我猜这是因为 MSBuild 关闭了它。
您是否知道如何处理该问题,或者至少知道此类 MSBuild 行为的原因是什么?
问题似乎是 FodyWeaver 造成的。
Not Supported:
[...]
- Projects mixing the old .csproj format with new
<PackageReference>
nodes.
我认为 Fody 只是搞砸了构建过程。也许它执行类似于构建任务的操作(如@Crowcoder 所建议的那样),因此 MSBuild 锁定了 dll。
切换回 packages.config
后问题消失了。