February 7, 2012

Share the config file : how to handle the path like the dataFolder

When we use SVN or TFS normally we commit some .config file an especially the web.config. The problem happened when all the computers doesn’t have the same path structure. For example I will not use the same data folder as my colleague.

You have multiple solutions to handle including having different build configuration but I think that the easiest way to handle it is by simply using the virtual directories.

To create a virtual directory:
  1. In IIS right click on your website and select “Add Virtual Directory”
  2. The alias is the folder name (in your config file) and the physical path is the real folder
  3. In the config, the datafolder will look like
      <sc.variable name="dataFolder" value="/Data" />
      

1 comment:

  1. Great idea! I like to handle it by modifying App_Config/Include/DataFolder.config and I set my local path there. All developers will have a separate path and we do not commit this file.

    ReplyDelete