3

I have a Web Deploy Package that produces an App.SetParameters.xml file along with all the other package files. The SetParameters file has several setParameter nodes that are supposed to update connection strings, but whenever I execute the web deployment script it always reports 0 parameters changed. Looking at the deployed Web.config file shows that they were indeed not updated.

Verbose output of the deploy script doesn't say anything about why it is skipping my parameters; it never even mentions them. However, if I change one of the setParameter tags to a parameter tag it gives me an error:

Error: The parameter 'ConnectionString-Web.config Connection String' has already been defined.

So it is obviously finding that parameter in my Web.config. I am completely confused by why it would just skip parameters like this.

Environment:

  • Visual Studio 2012
  • Web Deploy 3.0
  • Windows Server 2008 R2
  • IIS 7
Anthony Mastrean
  • 20,318
  • 20
  • 92
  • 173
Matt Baker
  • 3,164
  • 3
  • 23
  • 34

1 Answers1

1

This problem was related to the issue raised in this question. Because I moved this solution from Visual Studio 2010 to Visual Studio 2012 all of my Web.config files still had this as their root node:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

This causes the xpath used by Visual Studio 2012 Web.config transforms to choke and results in the error:

No element in the source document matches '/configuration'

However, this error only appears when building the Web Deploy Package, not when running the web deploy package, so Web Deploy just thought there was no configuration section to update. You would think that no configuration section in a Web.config file would be a problem worth at least warning the user about, but apparently not.

The solution is to remove the xmlns attribute from the <configuration> node in the base Web.config file, publish the package from Visual Studio, and make sure the 'No element in source document' warning doesn't appear in the output anymore. After that Web Deploy should have no problem honoring your setParameter instructions.

Community
  • 1
  • 1
Matt Baker
  • 3,164
  • 3
  • 23
  • 34