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

时间:2022-09-01 23:42:58

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?

我们都知道我们应该只发布带有发布版本类型的ASP.NET Web应用程序,那么当我在Visual Studio 2008中触发“发布”命令时,为什么在配置为以调试模式构建的项目时不会收到警告?

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?

当然,可能会出现需要将调试版本发布到开发或测试环境的情况,但在这些情况下,在确认对话框中回答“是”是可以接受的。有没有我忽略的选项,强迫Visual Studio每次尝试发布调试版本时都会发出警告?

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.

是的,我们可以禁止使用“发布”命令并使用更加可靠的构建管理工具,但这涉及到流程的更改,在这种特定情况下可能不是一个选项。

3 个解决方案

#1


6  

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.

此外,即使没有构建系统,大多数人对不同的环境都有不同的配置文件,并且大部分都使用web.config设置来处理它。

#2


3  

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.

我使用Publish来构建和发布我的开发站点一直到开发服务器,关于这个的问题在我看来会很烦人。

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.

我认为这里的问题是你的个人过程而不是工具。生产版本应该远远不那么频繁,并且需要您更改网站发布的位置,如果您记得更改它,那么期望您发布正确的构建类型也不会太多。

#3


3  

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

您可以在生产服务器machine.config中设置deployment retail =“true”以停止担心它

<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

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

#1


6  

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.

此外,即使没有构建系统,大多数人对不同的环境都有不同的配置文件,并且大部分都使用web.config设置来处理它。

#2


3  

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.

我使用Publish来构建和发布我的开发站点一直到开发服务器,关于这个的问题在我看来会很烦人。

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.

我认为这里的问题是你的个人过程而不是工具。生产版本应该远远不那么频繁,并且需要您更改网站发布的位置,如果您记得更改它,那么期望您发布正确的构建类型也不会太多。

#3


3  

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

您可以在生产服务器machine.config中设置deployment retail =“true”以停止担心它

<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

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