I have an application dependent on some internal web services, and so we want our development and staging configurations to point to the development and staging servers for the web services.
Right now, this means manually editing my app.config file to point to the appropriate URLs. This is not only a hassle, but prone to human error ("oops, did I not remove that production URL?" can cause many-a-problem).
In a small handful of places in the code, I use the
#if DEBUG
// do something
#endif
preprocessing statement, and was wondering if something similar could be done for values in the app.config. I've been able to do this just fine with my app Settings, since these values are accessible in-code.
I'm aware of post-build scripts, but it seems like there might be an easier way than writing a routine to munge the app.config XML everytime I do a build. Any suggestions?
This is for C#, and .NET 3.5, and includes both old "web references" as well as the newer WCF "web services" references.