且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

运行 Visual Studio 调试.该进程无法访问该文件,因为它正被另一个进程使用

更新时间:2023-01-31 15:35:20

我在 VS2010 中发现了一个错误,关于引用多个项目的解决方案,其中至少有一个 WPF 控件库.当您打开 WPF 设计器时,项目引用的 DLL 被锁定.因此,尝试编译将发出该错误.

I've found a bug in VS2010, regarding solutions that reference multiple projects in which you have at least one WPF control library. When you open the WPF designer, the DLL's referenced by the project are locked. Therefore, trying to compile will issue that error.

如果这是您遇到的情况,AFAIK 没有解决方案,但作为解决方法:1. 确保关闭所有 WPF 打开的设计器2. 全部重建,然后清理解决方案,然后再次构建.这在大多数情况下都有效

If this is the scenario you are suffering, there's no solution AFAIK, but as workaround: 1. Make sure to close ALL the WPF open designers 2. Make a rebuild all, then clean solution, then build again. This works most of the time

或者,在 VS2010 中的 XML 编辑器中打开 XAML 文件,因此不会加载设计器.我通常直接写XAML.如果你非要写一个更复杂的XAML,那就用VS2010并排打开Blend,这样你就可以在Blend中编辑XAML,在VS2010中编译调试了.

Or, open the XAML files in XML editor in VS2010, so the designer is not loaded. I usually write XAML directly. If you have to write a more complex XAML, then open Blend side-by-side with VS2010, so you edit XAML in Blend and compile and debug in VS2010.