web.config转换在构建服务器上不起作用 [英] web.config transformation does not work on build server

查看:84
本文介绍了web.config转换在构建服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在与Team City建立持续集成,以签到为基础.这可以很好地工作,但是它始终使用默认的web.config进行构建,而不会使用开发环境特定的Web配置进行转换. 在Visual Studio中,我为开发创建了自定义生成配置.当我选择了development配置在本地发布时,web.development.config可以正确转换,但是在构建服务器上不会发生这种情况. 在Team City中,作为msbuild步骤的一部分,我创建了一个构建参数sys.configuration,并将值传递给development.但是,当它运行时,不会使用开发设置来转换生成的web.config.我也尝试将命令行参数设置为/p:configuration=development,但没有成功.

We are setting up continuous integration with team city doing builds on check-ins. This works fine, however it always builds with default web.config, it does not transform with development environment specific web config. In Visual Studio, I have custom build configuration created for development. The web.development.config transforms correctly when I publish locally with development configuration selected, but this does not happen on the build server. In team city, as part of msbuild step I have created a build parameter sys.configuration and I am passing development as the value. But when it runs, the resulting web.config is not transformed with the development settings. I also tried setting the command line parameter to /p:configuration=development with no success.

任何帮助将不胜感激.

推荐答案

我们一直在Web应用程序项目中使用发布目标,并且看到构建过程正确地转换了我们的web.config文件,但是当我们移动构建到我们的CI服务器上,就没有应用转换.

We've been using publish targets in our web application projects and had seen that the build process was correctly transforming our web.config files, but when we moved the build to our CI server, the transforms were not being applied.

MSBuild脚本使用的是:

The MSBuild script were using was:

MSBuild.exe PATH_TO_PROJ.csproj /p:DeployOnBuild=true /p:PublishProfile=PUBLISH_TARGET

我们发现,我们仍然需要将Configuration指定为Debug或Release(即使这似乎是发布目标的属性).

What we found was that we still needed to specify the Configuration as Debug or Release (even though this appears to be an attribute of the publish target.)

MSBuild.exe PATH_TO_PROJ.csproj /p:DeployOnBuild=true /p:PublishProfile=PUBLISH_TARGET /p:Configuration=Release

这篇关于web.config转换在构建服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆