Pregunta

I have web.config file that overrides items in Settings file like this:

<applicationSettings>
    <MvcApplication.Properties.Settings>
      <setting name="FacebookUrlAuth" serializeAs="String">
        <value>http://URL1.com</value>
      </setting>
      <setting name="GoogleUrlAuth" serializeAs="String">
        <value>http://URL2.com</value>
      </setting>
    </MvcApplication.Properties.Settings>
  </applicationSettings>

And I have web.release.config that transforms these settings:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <applicationSettings>
    <MvcApplication.Properties.Settings>
      <setting name="FacebookUrlAuth" serializeAs="String" xdt:Locator="Match(name)" xdt:Transform="Replace">
        <value>http://AlternativeUrl1.com</value>
      </setting>
      <setting name="GoogleUrlAuth" serializeAs="String" xdt:Locator="Match(name)" xdt:Transform="Replace">
        <value>http://AlternativeUrl2.com</value>
      </setting>
    </MvcApplication.Properties.Settings>
  </applicationSettings>
</configuration>

When I publish solution in Release configuration it works properly (I mean only url's are become different from web.config)

But when Appharbor publishes the application I get a runtime error from the page I use @Settings.Default.FacebookUrlAuth

with the following details:

Unrecognized element 'setting'. (D:\websites\45\31968\17022\0x0001_PublishedWebsites\MVC.Web\web.config line 73)

When I comment all transformation rules, AppHarbor takes these properties from my default web.config and everything works ok. Is it an issue on the AppHarbor side?

¿Fue útil?

Solución

You can't have multiple setting elements. The error is probably not related to the transformation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top