Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 53499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:04:23+00:00 2026-05-10T17:04:23+00:00

I have an application dependent on some internal web services, and so we want

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:04:23+00:00Added an answer on May 10, 2026 at 5:04 pm

    We used a program called XmlPreprocessor from SourceForge to handle this. It allows you to create parameters in your configuration files and different value files to populate them from.

    Given the following files:

    app.config

    ... <importantSetting>$importantSettingValue$</importantSetting> ... 

    qavalues.xml

    ... <importantSettingValue>QAvalue</importantSettingValue> ... 

    prodvalues.xml

    ... <importantSettingValue>PRODvalue</importantSettingValue> ... 

    A command line along the lines of following is all that’s needed to get the correct values in the correct places.

    XmlPreProcess.exe app.config qavalues.xml 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In onw of our application, we have some reports that need very specific margins
I have several properties that are dependent on the environment the application is running.
I'm working on a SaaS application where each customer will have different configurations depending
I have an application that sends messages to an external web service. I build
I have a simple Spring MVC application that looks up some user details from
I have a .NET application that references some C++ assemblies. My application requires the
I want to port wxwidgets opengl application that will be not library dependent.I want
I have an application the will load usercontrols dynamically depending on the user. You
I have an application which had optional extras depending on if the user has
I have an application which really should be installed, but does work fine when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.