473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

WEB config file deployment

Hi, I am confornted with a problem regarding web.config file. I have 4
environements (Dev, Test, staging and production). The IT people need
wgenever a new MSI delivered to have the right environment keys in there
sections and not the dev machines web config. What I mean by that I don't
want the IT people to edit the web config for each environement manually. Is
there any baset practices or patterns to automatically deploy goof web.config
files.
I use TFS for nightly builds and thinking of implememnting TFS a s the tool
which should be used by IT people to get delivarables in order to deploy them
instead of filling special froems and using files shares for delivarables.
Of course, I know that we can exclude the web.config from the msi and every
delivery people go and update manullay the file in another environment but I
dont want that either if possible of course.
Thanks.
Aug 20 '06 #1
2 1511
If you can keep your settings in the appSettings section, it has a "file="
optional attribute to specify a separate file from which the appSettings
section will be loaded, overwriting keys present in the original having the
same names.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"SalamElias" wrote:
Hi, I am confornted with a problem regarding web.config file. I have 4
environements (Dev, Test, staging and production). The IT people need
wgenever a new MSI delivered to have the right environment keys in there
sections and not the dev machines web config. What I mean by that I don't
want the IT people to edit the web config for each environement manually. Is
there any baset practices or patterns to automatically deploy goof web.config
files.
I use TFS for nightly builds and thinking of implememnting TFS a s the tool
which should be used by IT people to get delivarables in order to deploy them
instead of filling special froems and using files shares for delivarables.
Of course, I know that we can exclude the web.config from the msi and every
delivery people go and update manullay the file in another environment but I
dont want that either if possible of course.
Thanks.
Aug 20 '06 #2
Uli
Hi,

here is the way I'm doing it.

Set a machine identity in the machine.config that says if it is a
development, stage or production server (e.g. d, s or p. It might be good to
add an "l" for local also).

for the Development-server
<add key="ApplEnv" value="d" />
Then you can put the connection strings for all environments into the
web.config

<add key="ConnectionString-l" value="server=(local);......."/>
<add key="ConnectionString-d" value="server=DEV-Server;......"/>
<add key="ConnectionString-s" value="server=STG_Server;....."/>
<add key="ConnectionString-p" value="server=PRD-Server;....."/>

In your code put something like:

private static string DbConnectionString
{
get
{
string strApplEnv = ConfigurationSettings.AppSettings["ApplEnv"];
string paramSuffix = strApplEnv.ToLower().Substring(0,1);
return ConfigurationSettings.AppSettings["ConnectionString-" +
paramSuffix] ;
}
This way you can use the web.config for all environments.

Regards,
Uli

--
Wer nicht fragt, stirbt dumm.
If you don't ask, you'll die as a dumba**.
"SalamElias" wrote:
Hi, I am confornted with a problem regarding web.config file. I have 4
environements (Dev, Test, staging and production). The IT people need
wgenever a new MSI delivered to have the right environment keys in there
sections and not the dev machines web config. What I mean by that I don't
want the IT people to edit the web config for each environement manually. Is
there any baset practices or patterns to automatically deploy goof web.config
files.
I use TFS for nightly builds and thinking of implememnting TFS a s the tool
which should be used by IT people to get delivarables in order to deploy them
instead of filling special froems and using files shares for delivarables.
Of course, I know that we can exclude the web.config from the msi and every
delivery people go and update manullay the file in another environment but I
dont want that either if possible of course.
Thanks.
Oct 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Darwin Fisk | last post by:
I have an app that is deployed that uses .config file settings. I have an update of that app that I am installing using a setup and deployment project. The basic setup process works fine. Now I...
3
by: Marek | last post by:
Hi there, my WinForm application has to be installed in "no-touch-deployment" mode, so users can run it from the web. I need to read application's .config file but it does not work in ...
9
by: ALI-R | last post by:
Hi,, I have two questions : 1) Is it mandatory that config file of a desktop application must be App.config 2) Is it possible to update config file in your code?? thanks for your help. ALI
0
by: Andy | last post by:
Hi all, I'd like to have an App.config file for development, then when I build the deployment package (using one of the VS.net projects), i'd like to specify a different .config file to install...
1
by: savajx1 | last post by:
I am using the new "web deployment addin" in VS 2005 to output my web site. The web site is correctly output (assemblies generated in the \bin subdirectory). The web site on my developement...
5
by: ad | last post by:
I am developing web applicaiton with VS2005. The WebApp used a ClassLibrary in another project. There are some TableAdapter in the classlibrary, and the TableAdapter use the connection in the...
0
by: =?Utf-8?B?SWFu?= | last post by:
Hi, I'm using VS 2005 SP1 with Web Deployment Project download v8.0.51103, according to the Add/Remove programs applet. I've got a file based web service project with an associated web...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
I've added a web deployment project and want to use the config section replacement but I'm obviously not understanding something. I have set up an alternate appSettings file,...
1
by: =?Utf-8?B?Q2h1Y2sgUA==?= | last post by:
I have an asp.net solution with a web deployment project. When we try to build/debug, we get the message: An editor or project is attempting to check out a file that is modified in memory,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.