构建过程中设置web.config文件属性(不通过发布) [英] Setting web.config properties during build (not through publishing)

查看:192
本文介绍了构建过程中设置web.config文件属性(不通过发布)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图部署使用Web安装项目的应用程序。我遇到的问题是web.config文件是永远不会改变。根据本<一href=\"http://stackoverflow.com/questions/3922291/use-visual-studio-web-config-transform-for-debugging\">post这是由设计,改造仅在发布发生。我如何获得在web.config属性来正确地更新,如果建设反过来安装项目将其它的组件构建命令?

I'm trying to deploy an app using a Web Setup Project. The problem I'm running into is that the web.config file is never transformed. According to this post it's by design that transformation only takes place during a publish. How do I get the web.config properties to update correctly if building the Setup Project in turn calls the other assemblies build command?

推荐答案

我固定它通过增加像舍甫琴科K A虚拟web.Template.config文件建议在此<一个href=\"http://stackoverflow.com/questions/5082126/how-do-i-do-web-config-transformations-with-visual-studio-website-projects\">post,然后我BeforeBuild事件像这样过程中调用的TransformXML:

I fixed it by adding a dummy web.Template.config file like Andriy K suggested in this post, and then calling TransformXml during my BeforeBuild event like so:

<Target Name="BeforeBuild">
<TransformXml Source="$(WebFolderName)Web.Template.config"
              Transform="$(WebFolderName)Web.$(Configuration).config"
              Destination="$(WebFolderName)Web.config" />
</Target>

这篇关于构建过程中设置web.config文件属性(不通过发布)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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