473,378 Members | 1,492 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,378 software developers and data experts.

debug/release web.config?

Hi

I've been reading about various ways in which people can have multiple
web.config "sections" for different scenarios (configSource proerty, etc).

In my situation, I just have a dev and production environments, and I'm
using VS2008 .net 3.5.

I'm wondering, is there not some sort of conditional compilation I can do,
where if it's I compile in Debug mode it will use web.config.debug or if I
compile for release it uses web.config.release ?!

Is that at all possible, other than manually renaming the files!?

Thanks,
Dan
Jul 7 '08 #1
3 2561
In general, you can move most of the config elements that will change to
other files. For example, I routinely use db.config for my connection
strings and appSettings.config for app settings. You then exclude publishing
of these files and you can move the rest of the application up to the
server. I find that to be easiest and have yet to have a situation where it
does not work.

Now, if you have elements that cannot be moved to another file, you can play
with the compile (and publish?) to add some post steps that "fix" the
config. At least that is where I would look. I use post build steps
routinely in some of the apps I have under my control.

If neither of these work, you will have to tred carefully. Posting the site
to a staging folder before publishing to the production site is a wise move.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
"musosdev" <mu*******@community.nospamwrote in message
news:23**********************************@microsof t.com...
Hi

I've been reading about various ways in which people can have multiple
web.config "sections" for different scenarios (configSource proerty, etc).

In my situation, I just have a dev and production environments, and I'm
using VS2008 .net 3.5.

I'm wondering, is there not some sort of conditional compilation I can do,
where if it's I compile in Debug mode it will use web.config.debug or if I
compile for release it uses web.config.release ?!

Is that at all possible, other than manually renaming the files!?

Thanks,
Dan
Jul 7 '08 #2
The Web Deployment Projects are the solution you're looking for. The section
replacement capabilities can modify any piece of the configuration files
that you need them to. Just install the software, right click on your
website project and click on Add deployment project (think that's the name,
I don't have VS open right now). Should add a new project to your solution,
you can go to the properties for the new project and set the section
replacements in there.

Here's the link:
http://www.microsoft.com/downloads/d...B-FE697256C459

You'll need one deployment project for each environment you plan on
deploying the site to. For example, if you have a development, staging, and
production environment you may consider creating two deployment projects.
One for staging, and another for production, since the development server
can probably use the same settings as the developers who work on the sites.

Also, don't forget to update your build configuration for the solution so
you aren't building the deployment projects unnecessarily when you don't
need them. IE, building the production deployment project when the developer
is trying to use them.

There's quite a bit of resources on the web regarding these projects as
well, so you shouldn't have a problem getting them working for you.

Good luck!

"musosdev" <mu*******@community.nospamwrote in message
news:23**********************************@microsof t.com...
Hi

I've been reading about various ways in which people can have multiple
web.config "sections" for different scenarios (configSource proerty, etc).

In my situation, I just have a dev and production environments, and I'm
using VS2008 .net 3.5.

I'm wondering, is there not some sort of conditional compilation I can do,
where if it's I compile in Debug mode it will use web.config.debug or if I
compile for release it uses web.config.release ?!

Is that at all possible, other than manually renaming the files!?

Thanks,
Dan
Jul 7 '08 #3
Thanks guys, some very helpful info!
"Jeff Winn" wrote:
The Web Deployment Projects are the solution you're looking for. The section
replacement capabilities can modify any piece of the configuration files
that you need them to. Just install the software, right click on your
website project and click on Add deployment project (think that's the name,
I don't have VS open right now). Should add a new project to your solution,
you can go to the properties for the new project and set the section
replacements in there.

Here's the link:
http://www.microsoft.com/downloads/d...B-FE697256C459

You'll need one deployment project for each environment you plan on
deploying the site to. For example, if you have a development, staging, and
production environment you may consider creating two deployment projects.
One for staging, and another for production, since the development server
can probably use the same settings as the developers who work on the sites.

Also, don't forget to update your build configuration for the solution so
you aren't building the deployment projects unnecessarily when you don't
need them. IE, building the production deployment project when the developer
is trying to use them.

There's quite a bit of resources on the web regarding these projects as
well, so you shouldn't have a problem getting them working for you.

Good luck!

"musosdev" <mu*******@community.nospamwrote in message
news:23**********************************@microsof t.com...
Hi

I've been reading about various ways in which people can have multiple
web.config "sections" for different scenarios (configSource proerty, etc).

In my situation, I just have a dev and production environments, and I'm
using VS2008 .net 3.5.

I'm wondering, is there not some sort of conditional compilation I can do,
where if it's I compile in Debug mode it will use web.config.debug or if I
compile for release it uses web.config.release ?!

Is that at all possible, other than manually renaming the files!?

Thanks,
Dan
Jul 8 '08 #4

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

Similar topics

1
by: Eddy | last post by:
Problem: In 'solution A', 'project 1' references 'project 2'. As such, when 'solution A' is built (debug mode), project '1' creates a dll in /debug, and project '2' referneces that dll. All is good....
2
by: Coder Coder | last post by:
Hi, Im want to release my web project and the configurations inside my web.config are very different from my development environment to my production environment. I was wondering is there a...
6
by: Luis Esteban Valencia | last post by:
Hi, I want in debug mode debug=true. In release (production), no reason debug to be true but the questions are: 1. Does it slow the application (holding debug=true) 2. If yes, how can I solve...
9
by: dee | last post by:
Hi I'm about to upload my site and I have switched to release version. Is that enough or do I still need to disable <compilation defaultLanguage="vb" debug="true" /> the debug="true" in the .pdb...
10
by: Joe Befumo | last post by:
When I tried debugging for the first time, I pop-up asked me if I wanted to set the project to enable debugging. Now I'm ready to release and can't find anyplace to set the build to 'release'. A...
0
by: RonL | last post by:
Using Visual Studio, what is the difference between using Configuration Manager to set the Active Solution Configuration to Debug/Release and using Web.config to set Compilation to "debug=true"....
2
by: muriwai | last post by:
Hi, I have <compilation debug="true"in my web.config. The trouble is that I have to manually change this to "false" every time I publish the website. I tried moving this to global machine.config...
0
by: =?Utf-8?B?TWlrZVo=?= | last post by:
VB.NET 2005 Release Folder and Debug Folder confuse me a lot. I used a application configuration file which locate in the same folder as EXE file. The config file is set by application. When I use...
5
by: Andy B | last post by:
How do you tell vs2005 to keep debug info out of your release builds? When I build a release and a debug version, there seems to be no difference in them at all...The release builds still have the...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.