Link to home
Start Free TrialLog in
Avatar of porter416
porter416

asked on

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
Avatar of ihenry
ihenry

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.
Avatar of porter416

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Learned something new.  Thanks!

DP