2

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.

2
  • Can you clarify further ? Commented Aug 19, 2013 at 9:14
  • 2
    The web config is only transformed when you publish the project. Not when you just compile the project. Commented Aug 19, 2013 at 9:15

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried, but it seems that my only option is to publish to Azure.
Not only for Azure, click on "Publish Web Site" and you will see different options (traditional ones like there was before Microsoft created Azure).
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.