使用ASP.NET 4.5发布配置文件时,如何参数化部署? [英] How do you parameterize deployments when using ASP.NET 4.5 publish profiles?

查看:234
本文介绍了使用ASP.NET 4.5发布配置文件时,如何参数化部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET 4.5中的新pubxml文件绝对是朝正确方向迈出的一步. 我也喜欢msdeployparameters.xml文件的支持(即使它们有时不如我想要的强大).现在,如何结合msdeploy的参数和pubxml文件? 我希望pubxml文件将允许我提供

The new pubxml files in ASP.NET 4.5 are definitely a step in the right direction. I also like msdeploy's support for parameters.xml files (even though they are sometimes not as powerful as I would like). Now, how do I combine msdeploy's parameters and the pubxml files? I would expect that the pubxml files would allow me to provide a setting like

<ParametersFile>productionParameters.xml</ParametersFile>

或我的production.pubxml文件中的类似内容,其中包含在发布到生产环境时要合并到web.config中的值.可能吗,还是我必须回到自己的方式来确定参数文件并使用-setParamFile ="productionParameters.xml"调用msdeploy?

or something similar in my production.pubxml file, that would contain values to be merged into web.config when publishing to the production environment. Is that possible or do I have to go back to rolling my own way of determining the parameters file and invoking msdeploy with -setParamFile="productionParameters.xml"?

推荐答案

您不能设置自己的参数文件,但可以在pubxml中声明参数值:

You can't set your own parameters file, but you can declare parameter values from within the pubxml:

<ItemGroup>
  <MSDeployParameterValue Include="Parameter Name">
    <ParameterValue>Parameter Value</ParameterValue>
  </MSDeployParameterValue>
</ItemGroup>

这篇关于使用ASP.NET 4.5发布配置文件时,如何参数化部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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