我正在使用msdeploy通过teamcity部署asp.net-mvc web应用程序。
我正在使用paramaters.xml文件来操作我的应用程序的web.config文件,特别是应用程序设置部分。
我有一些设置,只有在特定环境下有值,其余时间该值应为空(即在生产环境中仅Property才有值)。但是,当我不指定一个值时,MSDeploy会抛出此异常:
Microsoft.Web.Deployment.DeploymentException:
The 'facebookUserToken' argument cannot be null or empty.
at Microsoft.Web.Deployment.DeploymentSyncParameterValidation.Validate(String parameterName, String parameterValue)
at Microsoft.Web.Deployment.DeploymentSyncParameter.set_Value(String value)
at Microsoft.Web.Deployment.DeploymentSyncParameterCollection.LoadFromFile(XPathNavigator nav, String fileName, Boolean ignoreExtraSetParameters)
at Microsoft.Web.Deployment.DeploymentSyncParameterCollection.Load(Stream stream, String fileName, Boolean ignoreExtraSetParameters)
at Microsoft.Web.Deployment.DeploymentSyncParameterCollection.Load(String fileName, Boolean ignoreExtraSetParameters)
at MSDeploy.MSDeploy.HandleSetParameters(DeploymentObject sourceObject, Random random)
at MSDeploy.MSDeploy.ExecuteWorker()
at MSDeploy.MSDeploy.Execute()
at MSDeploy.MSDeploy.Main(String[] unusedArgs)
如何配置 MSDeploy 以允许参数具有空值?
web.config:
<applicationSettings>
<SO.Example>
<setting name="FacebookUserToken" serializeAs="String">
<value></value>
</setting>
</SO.Example>
</applicationSettings>
parameters.config:
<parameter name="facebookUserToken" description="" defaultValue="">
<parameterEntry kind="XmlFile" scope="Web.config"
match="XPath removed for readability">
</parameterEntry>
</parameter>
parameterValidation
应该有kind
属性而不是type
属性。 - rino.batin