473,326 Members | 2,655 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,326 software developers and data experts.

Detect build config

Is it possible to detect the build config via code.
I want to run a program with a different connection string when in debug
config

any ideas?
Sep 11 '08 #1
2 790
public static class Settings
{
public static string ConnectionString
{
get
{
#if DEBUG
return "debug connection string";
#else
read it from the app.config file
#endif
}
}
}
Sep 11 '08 #2
ThatsIT.net.au wrote:
Is it possible to detect the build config via code.
/Any/ Configuration - not that I know of. (You're /not/ just limited to
Debug and Release.)
I want to run a program with a different connection string when in debug
config
Now; is that just /built/ with the Debug Configuration ...

sConnection = ...

#If DEBUG Then
sConnection = ... ' Debug-only settings
#End if

.... or any time you're actively debugging the code?

sConnection = ...

If System.Diagnostics.Debugger.IsAttached Then
sConnection = ... ' Debug-only settings
End if

(Or combine the two, for even greater safety).

HTH,
Phill W.
Sep 11 '08 #3

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

Similar topics

1
by: Bren | last post by:
Hi, Pardon my stupid, but I'm having a problem building Boost.Python as per the instructions at http://www.boost.org/libs/python/doc/building.html I got boost-build-2.0-m6.zip from...
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
6
by: H | last post by:
This is a question that has haunted me for quite some time. if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection...
3
by: Christopher Baldwin | last post by:
Hello, Using ASP.NET v2.0.40607.42, I'm attempting to create a new file extension that should be handled exactly like "aspx" pages. For example, I just want to rename an aspx page from...
4
by: Allan Ebdrup | last post by:
Hi I'm Using VS.Net 2003 and am trying to get the app.config file copied to the directory of the target dll by using a post build command. In Properties/Common Properties/Build Events/Post-build...
1
by: Steve.Goodman | last post by:
Appologies if this has already been asked, but after scanning the web and this news group I could find no decent solution. We have a windows App that calls a webservice, using this bit of basic...
2
by: Spam Catcher | last post by:
Is there a way to script VS.NET to copy different app.config along with different build configurations? In fact, it would be great if I could dynamically substitute app.config values for...
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,...
7
by: eschneider | last post by:
I have a webservice which every time I build it keeps adding Crystal references into the web.config? <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral,...
4
by: ThatsIT.net.au | last post by:
Is it possible to detect the build config via code. I want to run a program with a different connection string when in debug config any ideas?
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
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...

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.