如何避免从 Visual Studio 以调试模式发布 ASP.NET 应用程序?
我们都知道我们应该只发布我们的 具有发布构建类型的 ASP.NET Web 应用程序,那么为什么当我在 Visual Studio 2008 中触发“发布”命令时,对于配置为在调试模式下构建的项目,我没有收到警告?
当然,在某些情况下,我可能需要将调试版本发布到开发或测试环境,但在这些情况下,在确认对话框中回答“是”是可以接受的。是否有一个我忽略的选项,迫使 Visual Studio 在我每次尝试发布调试版本时发出警告?
是的,我们可以禁止使用“发布”命令并使用更可靠的 构建管理工具,但这涉及流程的更改,在这种特殊情况下可能不是一个选项。
We all know that we should only be publishing our ASP.NET Web Applications with release build type, so why do I not get a warning when I trigger the "Publish" command in Visual Studio 2008, for a project configured to build in debug mode?
Sure, there might be cases where I need to publish a debug build to a development or test environment, but answering yes in a confirmation dialog would be acceptable in these cases. Is there an option that I have overlooked, forcing Visual Studio to warn me every time I try to publish a debug build?
Yes, we could just ban using the "Publish" command and use a more solid build management tool, but this involves a change of process and might not be an option in this particular case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常这样的事情是在自动化构建工具中处理的。坦率地说,我向开发站点发布的频率比向生产站点发布的频率高出几个数量级。
仅出于这个原因,在此过程中出现一个额外的对话框就有点让人抓狂了。
此外,即使没有适当的构建系统,大多数人也会针对不同的环境使用不同的配置文件,并且大多数情况下使用 web.config 设置来处理它。
Typically things like this are handled in an automated build tool. Quite frankly, I publish to a dev site by orders of magnitude more often than I do to production.
For that reason alone having an extra dialog box in the process would be a bit maddening.
Further, even without a build system in place, most people have different config files for the different environments and for the most part handle it with a web.config setting.
我一直使用 Publish 来构建我的开发站点并将其发布到开发服务器,在我看来,有关此的问题只会令人恼火。
我认为这里的问题是你的个人流程之一,而不是工具。生产版本的频率应该要低得多,并且需要您更改站点发布到的位置,如果您记得更改它,那么期望您发布正确的构建类型也并不过分。
I use Publish to build and publish my development sites to the dev servers all the time, a question about this would just be irritating in my opinion.
I think the issue here is one of your personal process rather than the tool. Production releases should be far less frequent and would require you to change the location the site is being published to, if you remember to change that then it's not too much to also expect that you are publishing the correct build type.
您可以在生产服务器
machine.config
中设置deployment Retail="true"
来不再担心它来自 Scott Guthrie 文章的提示 不要在启用 debug=”true” 的情况下运行生产 ASP.NET 应用程序
You can set
deployment retail="true"
in your production servermachine.config
to stop worrying about itTip from Scott Guthrie's article Don’t run production ASP.NET Applications with debug=”true” enabled