简体   繁体   English

如何使用web.other.config覆盖文件web.config?

[英]How can I overwrite file web.config with web.other.config?

I have a msbuild script with custom logic to deploy my service to the qa server automatically. 我有一个带有自定义逻辑的msbuild脚本,可将我的服务自动部署到qa服务器。 I have to overwrite the default config with a dedicated one, but when I use <Copy SourceFiles="web.other.config" DestinationFiles="web.config" /> it does nothing. 我必须用专用的配置覆盖默认配置,但是当我使用<Copy SourceFiles="web.other.config" DestinationFiles="web.config" />它什么也没做。

How can I make it work? 我该如何运作?

Thats exactly what I do in my build scripts and it looks fine. 那就是我在构建脚本中所做的,而且看起来还不错。 Are you sure you not getting any file permission issues. 您确定没有遇到任何文件权限问题。 when overwriting the file? 覆盖文件时?

try deleting the destination file first if it already exists. 请尝试先删除目标文件(如果已存在)。

<Delete Files="web.config" ContinueOnError="false"></Delete>
<Copy SourceFiles="web.other.config" DestinationFiles="web.config"></copy>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM