如何避免从 Visual Studio 以调试模式发布 ASP.NET 应用程序?

发布于 2024-08-22 06:14:53 字数 535 浏览 3 评论 0原文

我们都知道我们应该只发布我们的 具有发布构建类型的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

毅然前行 2024-08-29 06:14:53

通常这样的事情是在自动化构建工具中处理的。坦率地说,我向开发站点发布的频率比向生产站点发布的频率高出几个数量级。

仅出于这个原因,在此过程中出现一个额外的对话框就有点让人抓狂了。

此外,即使没有适当的构建系统,大多数人也会针对不同的环境使用不同的配置文件,并且大多数情况下使用 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.

残花月 2024-08-29 06:14:53

我一直使用 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.

天暗了我发光 2024-08-29 06:14:53

您可以在生产服务器 machine.config 中设置 deployment Retail="true" 来不再担心它

<configuration>
    <system.web>
          <deployment retail="true"/>
    </system.web>
</configuration>

来自 Scott Guthrie 文章的提示 不要在启用 debug=”true” 的情况下运行生产 ASP.NET 应用程序

You can set deployment retail="true" in your production server machine.config to stop worrying about it

<configuration>
    <system.web>
          <deployment retail="true"/>
    </system.web>
</configuration>

Tip from Scott Guthrie's article Don’t run production ASP.NET Applications with debug=”true” enabled

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文