我正在尝试使用 Web 安装项目部署应用程序。我遇到的问题是 web.config 文件从未被转换。根据这个post https://stackoverflow.com/questions/3922291/use-visual-studio-web-config-transform-for-debugging根据设计,转换仅在发布期间发生。如果构建安装项目依次调用其他程序集构建命令,如何正确更新 web.config 属性?
我通过添加一个虚拟的 web.Template.config 文件来修复它,就像 Andriy K 在此建议的那样post https://stackoverflow.com/questions/5082126/how-do-i-do-web-config-transformations-with-visual-studio-website-projects,然后在 BeforeBuild 事件期间调用 TransformXml,如下所示:
<Target Name="BeforeBuild">
<TransformXml Source="$(WebFolderName)Web.Template.config"
Transform="$(WebFolderName)Web.$(Configuration).config"
Destination="$(WebFolderName)Web.config" />
</Target>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)