Multiple config files for a soultion

Hi,

I have a solution that has a few projects (both Windows and Web) and I am going slightly mad as I try to handle the multiple config settings for my clients UAT, production and our own internal testing and development.  I am using VStudio 2003 and Source Safe v6.0d.

Is there a way I can set this up just once with all the settings (somewhere) so all I have to do is go to the Build -> Config Manager and change it?  If not, is there another simple way to change it all in one spot as the code moves around?

Thanks,
DP
porter416Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ihenryCommented:
Create four new configuration (from configuration manager), for example DEBUG_SIT, DEBUG_DEV, RELEASE_UAT and RELEASE_PRD. For each configuration, create macro in the web project's "Post-Build Command Line". The macro will look similar with the following

      echo -- start macro
      set config = $(ConfigurationName)

      if config == "DEBUG_SIT" goto DEBUG_SIT
      if config == "DEBUG_DEV" goto DEBUG_DEV
      if config == "RELEASE_UAT" goto RELEASE_UAT
      if config == "RELEASE_PRD" goto RELEASE_PRD

      DEBUG_SIT:
      echo Copy web.config for internal testing
      copy "web.sit.config" "..\web\web.config" /-Y
      goto END

      DEBUG_DEV:
      echo Copy web.config for development
      copy "web.dev.config" "..\web\web.config" /-Y
      goto END
      ...
      ... continue for other configuration settings
      ...

      END:
      echo -- end macro

Do similar for the Windows project and other projects that use config file.
0
porter416Author Commented:
Thanks,

This looks exactly like what I need except:
- I can't find the Post Build Command Line arg (I checked the Project -> prj_name Properties and couldn't find it)
- Does the Global.asax get used 'post build'?  That is a 2nd file I need to constantly change for my web app.?

Thanks,
DP
0
ihenryCommented:
Hello, DP

My apology for coming back so late, but very strange..I never received email notification for your reply??

Post-Build is not available in web project.  Sorry my mistake, I used to think that would work coz I have several web project that actually are just library type of project. Anyway, for a real web project I have another idea. Just do the following.


1. Under the solution,
    - Press Ctrl+Shift+N to create a new project
    - Click on Visual C++ project type and select "Makefile project" template
    - Give it a name, assuming its name is "Post-Build"
    - "Makefile Application Wizard" dialog opens then click Finish button
    - Press Ctrl+Alt+L to open Solution Explorer window
    - Right click on the "Post-Build" project and select Properties
    - In the "Post-Build" property pages, click General under "Configuration Properties" and
      select Utility for "Configuration Type"
    - Click Apply button and let the property pages open
    - Under "Build Events", click on "Post-Build Event", select "Command Line" and click on "Elipsis" button on the right
    - "Command Line" dialog opens and enter some macro in the textbox (see no.2)

2. The macro (same as my previous post)
      echo -- start macro
      set config = $(ConfigurationName)

      if config == "DEBUG_SIT" goto DEBUG_SIT
      if config == "DEBUG_DEV" goto DEBUG_DEV
      if config == "RELEASE_UAT" goto RELEASE_UAT
      if config == "RELEASE_PRD" goto RELEASE_PRD

      DEBUG_SIT:
      echo Copy web.config for internal testing
      copy "web.sit.config" "..\web\web.config" /-Y
      goto END

      DEBUG_DEV:
      echo Copy web.config for development
      copy "web.dev.config" "..\web\web.config" /-Y
      goto END

      ...
      ... continue for other configuration settings
      ...

      END:
      echo -- end macro

3. In configuration manager, create new configuration for DEBUG_SIT, DEBUG_DEV, etc.
4. In "Project Build Order" set the "Pre-Build" project to be executed at the last order

Please let me know if you have question on this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
porter416Author Commented:
Learned something new.  Thanks!

DP
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.