Team Foundation Server 项目是否可以有不同的 web.config 文件?

发布于 2024-08-05 07:47:01 字数 269 浏览 3 评论 0原文

我有一个简单的 ASP.NET MVC 网站。它具有调试、测试和发布配置模式。

我们使用 TFS 作为源代码控制和错误跟踪等。很好。

现在,我们即将开始使用团队构建来自动化一些持续集成。问题是,我们不确定如何制作它,因此如果我们想要进行 DEBUG 构建或 RELEASE 构建,它也会将正确的 web.config 文件放入目标目录中。此外,我们将 web.config 文件的某些部分提取到单独的文件中(例如连接字符串部分或机器密钥部分等)。是否可以将正确的环境文件正确地放入目标目录中。

I've got a simple ASP.NET MVC website. It has Debug, Testing and Release configuration modes.

We're using TFS as our source control and bug tracking, etc. Nice.

Now, we're about to embark on using Team Builds to automate some Continuous Intergration. The thing is, we're not sure how to make it so that if we want to make a DEBUG build, or a RELEASE build, it also drops the correct web.config file into the destination directory. Also, we have certain sections of the web.config file extracted to seperate files (eg. the connection string section or the machine key section, etc). Can the correct environment files be dropped correctly into the destination directory.

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

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

发布评论

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

评论(3

娇纵 2024-08-12 07:47:01

您可以执行预构建步骤< /a>

假设您已签入

  • /Debug.Web.Config
  • /Release.Web.Config

您可以编写一个预构建步骤来检查构建类型并将正确的 .config 文件复制到

  • /Web.Config

中顺便

cp $(ConfigurationName).Web.Config $(TargetDir)

说一句,ASP.net 4.0 将支持多个 Web.Config

http://weblogs.asp.net/gunnarpeipman/archive/2009/06/03/visual-studio-2010-multiple-web-config-versions。 ASPX

You could do a pre-build step

Say you have checked in

  • /Debug.Web.Config
  • /Release.Web.Config

You could write a pre-build step to check the build type and copy the proper .config file to

  • /Web.Config

Something like

cp $(ConfigurationName).Web.Config $(TargetDir)

On a side note, ASP.net 4.0 will have support for multiple Web.Configs

http://weblogs.asp.net/gunnarpeipman/archive/2009/06/03/visual-studio-2010-multiple-web-config-versions.aspx

梅窗月明清似水 2024-08-12 07:47:01

顺便说一句,使用预构建或构建后步骤在 Team Foundation Server 下都不起作用。它会自动配置构建目录的安全性,以防止在构建过程中对配置文件进行任何更改,无论是作为预构建事件还是作为构建后事件。使用 cp 的唯一结果是返回“访问被拒绝”错误。

Incidentally, using either a pre-build or post-build step will not work under Team Foundation Server. It automatically configures security on the build directory to prevent any changes being made to configuration files during the build process, whether as pre-build events or as post-build events. The only result of using cp is to return an "Access denied" error.

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