是否可以在调试时更改 Visual Web Dev,而无需停止/开始重新编译?
这可能是一个愚蠢的问题,但如果我不问并在 12 个月内发现这是可能的,我会觉得更愚蠢(当我意识到我可以使用 .aspx 文件完成我下面所要求的事情时,就会发生这种情况)。
是否可以在调试时更改我的项目文件(c# 类,在 asp.net mvc 环境中占主导地位)而无需重新编译? 具体来说,如果我在单步执行代码时发现错误,我希望避免停止调试,然后重新启动以及所有相关的等待。
谢谢, 詹姆士
This may be a stupid question, but I'll feel stupider if I don't ask and find out in 12 months that it was possible (this happened when I realized I could do what I'm requesting below with .aspx files).
Is it possible to change my project files (c# classes, which predominate in an asp.net mvc environment) without recompiling whilst debugging? Specifically, if I find a bug while stepping through code, I want to avoid stopping the debugging, then restarting, and all the associated waiting.
Thanks,
James
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。 在要更改代码的位置设置断点。 此外,您必须为每个项目转到“项目”->“项目”。 [项目名称]属性,单击“Web”选项卡...在“服务器”下选中“启用编辑并继续”。 仅当您使用 Visual Studio Dev Server 时才能执行此操作(我认为您应该始终这样做)。 如果您发现部署有问题,那么只需下载 Web 部署项目附加组件即可。
http://www.microsoft.com/downloads/details.aspx microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&displaylang=en
问候。
Yes. Set breakpoints around where you want to change the code. Also, you must for each project go to Project -> [Project Name] Properties, click on the Web tab ... under servers check Enable Edit and Continue. You will only be able to do this if you're using the Visual Studio Dev Server (which you should always do in my opinion). If you find that problematic to deploy than just downloda the Web Deployment Project add-on.
http://www.microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&displaylang=en
Regards.
您可以在有限的程度上执行此操作,这称为“编辑并继续”。 您可以修改变量的值,并将“当前行”箭头指示器移动到其他行以立即跳转/跳到该代码。
这是一篇博客文章,显示如何启用它。
您不能做的是全面编辑 - 更改方法、添加属性或从根本上更改类的编译方式。
请注意,您还可以在调试时使用立即窗口执行任意代码。 这是更改变量值和执行代码中存在的函数的好方法。
You can do this to a limited degree, it's called "Edit and Continue". You're allowed to modify values of variables, and move the "current line" arrow indicator to some other line to immediately jump/skip to that code.
Here's a blog post showing how to enable that.
What you can't do is full scale editing - changing methods, adding properties or basically changing the way your class would be compiling.
Note that you can also use the Immediate Window to execute arbitrary code while debugging. This can be a great way to play around with changing your variable values and executing functions that exist in your code.