6

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>

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"?

Rune
  • 8,340
  • 3
  • 34
  • 47

1 Answers1

12

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>
Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
  • 1
    Thank you for your time. Sorry, I don't quite follow. If I declare a parameter like that, what happens - are they only used by the publishing wizard or can I have them merged into web.config? After being declared here, where are they actually used? – Rune Oct 24 '12 at 14:21
  • 3
    The above syntax _is_ the assignment and is different for each Publish Profile. If you need to declare additional parameters (beyond the auto-generated parameters for connection strings and IIS Application), you can either define them in `wpp.targets` with `` or add a `Parameters.xml` to the root of your web application and anything defined in there will be merged with the auto-generated ones. – Richard Szalay Oct 24 '12 at 22:39
  • 5
    This technique doesn't seem to override defaults set in Parameters.xml. I had to redeclare the parameters, with defaults, with a priority that superseded Parameters.xml as described [here](http://sedodream.com/2013/03/02/MSDeployHowToUpdateAppSettingsOnPublishBasedOnThePublishProfile.aspx). – Carl G Nov 08 '13 at 19:44