简体   繁体   中英

Can I have web deploy just use a static web.config that overwrites completely?

I don't like fighting with xdt transforms because that is overkill for me and can consume quite a bit of time. Its MUCH easier to just have a complete copy of web.config for each profile and statically code in the changes.

For example I have a config profile and a publish profile (MyNewProfile) and I want my publish profile to just use the Web.MyNewProfile.config when it is deployed.

But I would like to have Web.MyNewProfile.config as just plain text- just a straight web.config file. So no transforming is happening its just replacing the Web.config completely with what I have in Web.MyNewProfile.config.

Is this possible?

Just target the entire configuration element in your Web.WhateverTransform.config file to transform as a replacement and then paste whatever you want inside of that element... It's not exactly what you've asked for, but it seems like a fair work-around. There's only one transform call and then your entire config file is transformed to whatever you want it to be, satisfying my understanding of your main objective: output a web.config with the content of a web.Another.config while eliminating the need to constantly babysit the transform calls.

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:Transform="Replace">
  <!-- this will be the only element within the configuration node post-transform -->
  <thing></thing>
</configuration>

我认为Visual Studio中的Web Deploy系统不会为您做到这一点(我可能错了,希望有人会纠正我),但是您可以让Web Deploy在不进行任何转换的情况下运行,然后手动复制您自己的Web部署完成后,将配置文件放在已部署文件的顶部,如果您想花大价钱,可以自己编写脚本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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