• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

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
0
porter416
Asked:
porter416
  • 2
  • 2
1 Solution
 
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
 
porter416Author Commented:
Learned something new.  Thanks!

DP
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now