Visual Studio - 如何将默认构建配置更改为发布?

发布于 2025-01-07 20:40:08 字数 156 浏览 0 评论 0原文

每当我在 VS 2010 中打开一个新的(Web)项目时,默认构建配置都会设置为“活动(调试)”。我在某处读到,如果我将这样的项目上传到服务器,会对性能产生轻微影响(这是真的吗?),所以我必须手动转到属性并在构建选项卡中更改它以发布。有没有办法告诉 VS 2010 在“发布”配置中打开每个新项目?

Whenever I open a new (web) project in VS 2010 the default build configuration is set to "Active (Debug)". I read somewhere that if I upload my project like this to the server it would have a slight affect on performance (is this true?), so I have to manually go to properties and change it in the build tab to release. Is there any way to tell VS 2010 to open every new project in 'release' configuration?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

您的好友蓝忘机已上羡 2025-01-14 20:40:08

我相信构建配置是按字母顺序列出的,并且在开始新项目时始终选择第一个。

由于默认情况下始终添加“调试”和“发布”配置,因此不幸的是,您总是会选择“调试”。

I believe the build configurations are listed alphabetically, and the first one is always selected when starting a new project.

Since Debug and Release configurations are always added by default, you'll always get Debug selected unfortunately.

北陌 2025-01-14 20:40:08

当您想要部署时,最好执行发布操作,因为这不仅会构建发布(或您希望的任何配置),而且只会生成应用程序所需的文件。您可以发布到本地文件夹,然后上传到远程服务器。

You would be better off performing a Publish operation when you want to deploy, as this will not only build in Release (or any configuration you wish), but also will only produce the files that are required by the application. You can publish to a local folder to then upload to a remote server.

甲如呢乙后呢 2025-01-14 20:40:08

打开该项目的 .csproj 文件并搜索是否有此行(通常在开头):

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

此行设置 调试 配置(如果尚未设置)。您可以将调试替换为发布

Open the .csproj file of that project and search if you have this line (typically at the beginning):

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

This line sets the Debug configuration if it's not set yet. You can replace Debug with Release

倦话 2025-01-14 20:40:08

是的,确实,dll 的内置调试模式的执行效率不如 dll 的内置发布模式。调试模式构建包含允许您在 dll 运行时将调试器附加到该 dll 的符号。这样做的结果是库集稍大一些,性能稍差。但是,除非您正在进行一些非常密集的数学处理,否则您可能不会注意到性能损失。

另一方面,发布模式将生成更小、更高效的 dll,但一旦部署应用程序,您将无法附加外部调试器。

我建议您在开发/测试时将应用程序保持在调试模式,然后在部署到生产之前切换到发布模式。

更新:我现在意识到我没有回答您最初的问题,但希望您发现这些建议有用。

Yes, it is true that dll's built in debug mode will not perform as efficiently as dll's built in release mode. A debug mode build includes symbols to allow you to attach a debugger to the dll while it is running. The result of this is slightly larger, less performant set of libraries. However, unless you are doing some really intense mathmatical processing, you probably wouldn't notice the performance loss.

Release mode on the other hand will produce smaller, more efficient dll's but you won't be able to attach an external debugger once you have deployed your application.

I would recommend you leave your applications in debug mode while in development/test, and then before deploying to production, switch to release mode.

UPDATE: I now realize I didn't answer your original question but hopefully you find the advice useful.

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