Visual Studio 2015在调试期间锁定DLL [英] Visual Studio 2015 locks DLL during debugging

查看:196
本文介绍了Visual Studio 2015在调试期间锁定DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个C#项目A,B和C.A和B两个参考C。来自A和B的C的引用设置为Copy Local,这意味着在C被构建为C.dll之后(在输出目录C),它被复制到A或B的输出目录(以编译的方式)



我有两个解决方案SA和SB。 SA包含A和C,SB包含B和C.我启动了Visual Studio 2015的2个实例。在一个实例中打开SA,另一个打开SA。



我是发现如果我从SA开始调试(F5)A,然后(当A仍在调试时),从SB更改为C并尝试编译SB,我收到一个编译错误,指出C.dll不能超过写入,因为它正在被另一个进程使用(devenv.exe正在运行SA的实例)。



这对我来说没有意义,因为编译C到C.dll并复制到A的输出目录,Visual Studio应该释放该文件上的锁。



我已经通过SA中的Modules窗口验证版本的C.dll加载是已被复制到A的输出目录的一个。



这开始发生在昨天,当我开始使用Visual Studio 2015(而不是Visual Studio 2013)。



有没有人有任何想法?我目前的解决方案是通过CTRL-F5(启动而不需要调试)来运行SA,但是当我想要在调试模式下同时运行SA和SB时,这变得烦人。



谢谢。



更新



我做了一些研究,为什么编辑并继续功能可能会导致描述的行为,并根据此页面 https://msdn.microsoft.com/en -us / library / ms164926.aspx >编辑并继续允许在调试会话中进行源代码修改,并且使结果生效,而不会停止调试,重新编译和重新启动调试会话(一个严重问题一定是)启用该功能后,Visual Studio可能需要随时重新编译任何依赖的DLL,以解释锁定。

解决方案

同样的问题。我改变了我的VS2015设置,似乎问题消失了:




  • disabled选项\Debugging\Edit并继续

  • -Options\Sourcecodemanagement from TFS to none -

  • -disabled Options\Debugging\Diagnostictools while debugging -



不确定是否导致锁定,但我怀疑在VS2013中没有的诊断工具。
(设置名称我从德文翻译成英文,不知道是否是英文VS版本的名称。)



编辑:
正如Shea研究的那样,编辑和继续功能锁定了DLL。


I have 3 C# projects A, B, and C. Both A and B reference C. The references to C from A and B are set to "Copy Local" implying that after C is built to C.dll (in the output directory of C), it is copied to the output directory of A or B (whichever is being compiled)

I have 2 solutions, SA and SB. SA contains A and C and SB contains B and C. I launch 2 instance's of Visual Studio 2015. I open SA in one instance and SB in the other.

I am finding that if I Start Debugging (F5) A from SA, and then (while A is still debugging), make a change to C from SB and attempt to compile SB, I receive a compile error stating that C.dll can not be over-written because it is in use by another process (the instance of devenv.exe which is running SA).

This does not make sense to me because after compiling C to C.dll and copying to the output directory of A, Visual Studio should release the lock on the file.

I have verified (via the Modules window in SA) that the version of C.dll loaded is the one which has been copied to the output directory of A.

This started occurring yesterday when I began using Visual Studio 2015 (instead of Visual Studio 2013).

Does anyone have any ideas? My current solution is to run SA via CTRL-F5 (start without debugging), but this becomes annoying when I want to run SA and SB in debug mode simultaneously.

Thanks.

UPDATE

I did some research into why the "Edit and Continue" feature could cause the described behavior, and according to this page https://msdn.microsoft.com/en-us/library/ms164926.aspx> Edit and Continue allows one to make source code modifications while in a debugging session and have the results take effect without stopping debugging, recompiling, and restarting the debugging session (what a gnarly problem that must have been). With that feature enabled, Visual Studio might be required to recompile any dependent DLL's at any time which explains the lock.

解决方案

I had the same problem. I changed my VS2015 settings and it seems the problem is gone:

  • disabled Options\Debugging\Edit and continue
  • -Options\Sourcecodemanagement from TFS to none-
  • -disabled Options\Debugging\Diagnostictools while debugging-

Not sure wich one caused the locking, but i suspect the diagnostictools wich I did not have in VS2013. (The settings names I translated from German to english, don't know if it is exactly how they are called in english VS version.)

Edit: As researched by Shea it was the Edit-And-Continue feature that locked the DLL.

这篇关于Visual Studio 2015在调试期间锁定DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆