Lemonbased
Lemonbased

Reputation: 63

Possible to use preprocessor directives in web.config?

I'd like to be able to do this so that I could do something like:

#if DEBUG
    <!--<customErrors mode="On" defaultRedirect="Error.aspx" />-->
#else
    <customErrors mode="On" defaultRedirect="Error.aspx" />

Possible? Would make life a little easier.

Upvotes: 3

Views: 1755

Answers (2)

John Gietzen
John Gietzen

Reputation: 49544

You can use something called a "Web Deployment Project" to swap out different config sections.

Just add custom .config files to your soulution and configure the WDP.

After that, you can just point the debug location to the deploy location and you should be set.

Upvotes: 2

Daniel A. White
Daniel A. White

Reputation: 190943

No, but there are ways to use build actions to achieve the same effect.

Upvotes: 1

Related Questions