简体   繁体   English

ASP.NET Web 应用程序强制在每个后端或代码文件上重建,使调试耗时且无法使用

[英]ASP.NET Web Application forces rebuild on every back-end or code-file, making debugging time consuming and unusable

I always prefer using a ASP.NET Web Site over ASP.NET Web Application, as defined here: ASP.NET Web Site or ASP.NET Web Application?我总是喜欢使用 ASP.NET 网站而不是 ASP.NET Web 应用程序,定义如下: ASP.NET 网站还是 ASP.NET Web 应用程序?

It is suggested that only use 'ASP.NET Web Site' projects if you really need to (stackoverflow's tag says this);建议仅在您确实需要时才使用“ASP.NET 网站”项目(stackoverflow 的标签说明了这一点); I would love to move away from this type of project, but the need to debug effectively and not waste time constantly recompiling projects for trivial changes makes me regret choosing the latter every time.我很想摆脱这种类型的项目,但是需要有效地调试而不是浪费时间不断地重新编译项目以进行微不足道的更改,这让我每次都后悔选择后者。

This is down to two key reasons.这归结为两个关键原因。

  1. Whenever you make a change to a back-end file or code-file, you are forced to rebuild the project before the change is available.每当您对后端文件或代码文件进行更改时,您都必须在更改可用之前重新构建项目。 With the 'ASP.NET Web Site', back-end files would be available immediately, and code-files within the 'App_Code' directory would trigger an automatic background rebuild enabling changes to be available within the next request with no developer input.使用“ASP.NET 网站”,后端文件将立即可用,“App_Code”目录中的代码文件将触发自动后台重建,从而无需开发人员输入即可在下一个请求中使用更改。
  2. Because of this constant requirement to rebuild, you cannot make a change while debugging without stopping/starting the debugger (unless you perform an attach-to-process with a few tweaks).由于不断需要重新构建,因此在不停止/启动调试器的情况下调试时无法进行更改(除非您通过一些调整执行附加到进程)。 This is very frustrating, especially when the project gets to a certain size where the compile time makes this completely impractical.这是非常令人沮丧的,尤其是当项目达到一定规模时,编译时间使其完全不切实际。 Not only that you lose all your debugging states, objects which were loaded in memory have been cleared, etc.不仅会丢失所有调试状态,内存中加载的对象也已被清除等。

I'm pretty sure I am missing something, as if Web Applications are the preferred project type by the majority, how can this be with such limitations?我很确定我遗漏了一些东西,好像 Web 应用程序是大多数人的首选项目类型,这怎么会有这样的限制? Are there solutions for this or suggestions on how to perform a series of small changes while debugging without stopping the debugger then manually performing a rebuild each time?是否有解决方案或有关如何在调试时执行一系列小更改而不停止调试器然后每次手动执行重建的建议? And is there a way to prevent back end files from needing a rebuild of the whole site?有没有办法防止后端文件需要重建整个站点? (I guess this is why 'ASP.NET Web Site' has a dll for every file or directory) (我想这就是为什么“ASP.NET 网站”为每个文件或目录都有一个 dll)

It is not a limitation, it's just how it works without the on-the-fly compilation of the WebSite template.这不是限制,它只是在没有 WebSite 模板的即时编译的情况下的工作方式。

You can use the Edit and continue feature of Visual Studio, but not every type of change is supported .您可以使用 Visual Studio 的“ 编辑并继续”功能,但并非所有类型的更改都受支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM