Domanda

Let's say that in my main startup project I have web.config file with some setting:

<!-- ... -->
<appSettings>
    <add key="Setting" value="setMe!" />
</appSettings>
<!-- ... -->

This project has two configurations: Release and Debug. Each transforms this setting to its own value, for example web.Debug.config:

<!-- ... -->
<appSettings xdt:Transform="Replace">
    <add key="Setting" value="debugValue" />
</appSettings>
<!-- ... -->

When I compile it there is no transformed config file. I have only three files: web.config, web.Debug.config and web.Release.config.

È stato utile?

Soluzione

You have to publish your project ("Publish Web Site" command) and your destination (IIS) will use the correct web.config file with your Release configuration.

Altri suggerimenti

Configuration transformation is only done when publishing. Your base configuration file should have your development settings. If you choose to use the default build configurations, normally the release transform file should contain your production environment settings and the debug transform file will contain your test environment settings.

Personally, I usually create a new build configuration for testing and for production and leave the debug and release transforms empty.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top