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

Is running in DEBUG or RELEASE MODE ?

pod
298 100+
Hello

I have several VB.NET Windows Form applications connecting tp several Network databases. When I build, update and test my apps, I want them to connect to a testing database as opposed to connecting to the production databases when the app is released.

Right now, I change a setting in my coding before releasing the app, but I would like this to be automatic, to prevent any testing data in the Production database and vice versa.

I found this piece of coding on the web, but it doesn't seem to ever be in DEBUG mode...
and by DEBUG mode I mean when I click the "Start Debugging" button or the F5 key

Expand|Select|Wrap|Line Numbers
  1. #If DEBUG Then
  2.     msgbox "DEBUG"
  3. #Else
  4.         MsgBox("NOT DEBUG !")
  5. #End If


Thank you for your input in advance



P:oD
Apr 14 '11 #1

✓ answered by R MacDonald

Hi, Perry,

Re: "am I right to presume that..."

No, that's not quite correct and so may be the source of the problem. You can run the code from the IDE in either DEBUG mode or RELEASE mode. And likewise, you can install and run either the DEBUG build or the RELEASE build outside of the IDE.

Which mode is being used is most easily controlled by using the "Solution Configurations" DropDown on the "Standard" toolbar. If the Standard toolbar is not displayed, you can also adjust the mode by using the "Build+Configuration Manager..." menu command. The latter will display a dialog that shows the defined configurations in a DropDown box in the upper left corner of the dialog. This dialog box also allows you to create new configurations (modes) or to rename/delete existing configurations. The specifications of the different configurations can be modified by using the "Compile" and "Debug" tabs on the Project Properties window.

Hope that helps.

Cheers,
Randy

5 6078
Hello, P:od,

In the IDE you can select either Debug mode or Release mode. (Actually, if the spirit moves you to do so, you can define other modes as well. But Debug and Release are provided by default.)

Select the Project+Properties menu item and choose the "Compile" tab from the tabs on the left hand side of the display. Select "Debug" from the "Configuration" drop down at the top left. Then click on the "Advanced Compile Options..." button. In the form that appears, ensure that the "Define DEBUG constant" CheckBox is checked. After clicking the [OK] button, change the "Configuration" drop down to "Release" and repeat the procedure, this time ensuring that the "Define DEBUG constant" CheckBox is NOT checked.

Your code example should then perform as expected. That is, when Debug configuration is specified, you should get the "DEBUG" MsgBox appearing when you start the application with the <F5> key. When Release configuration is specified, the "NOT DEBUG !" MsgBox will appear.

Cheers,
Randy
Apr 14 '11 #2
pod
298 100+
Hi Randy,

I was hopeful to have found a solution with your suggestion, but found my settings already set as you proposed, in both configuration mode.

I even updated my code to the following but to no avail.

#If Debug = True Then ...

Although, your suggestion was not a solution, it made me aware of these Configuration mode settings...There are two other settings, ... obviously, I will have to read up on this.

Maybe I am misunderstanding this DEBUG vs RELEASE mode:
am I right to presume that when I run the app from Visual Studio it is in DEBUG... and that when it is published and running from the Programs Files after installation, it is in RELEASE mode?

When publishing my app for use, should I be setting the configuration to Release? or is it done automatically?



Anything else you can offer is appreciated,

Thanks for answering



Perry :oD
Apr 15 '11 #3
Hi, Perry,

Re: "am I right to presume that..."

No, that's not quite correct and so may be the source of the problem. You can run the code from the IDE in either DEBUG mode or RELEASE mode. And likewise, you can install and run either the DEBUG build or the RELEASE build outside of the IDE.

Which mode is being used is most easily controlled by using the "Solution Configurations" DropDown on the "Standard" toolbar. If the Standard toolbar is not displayed, you can also adjust the mode by using the "Build+Configuration Manager..." menu command. The latter will display a dialog that shows the defined configurations in a DropDown box in the upper left corner of the dialog. This dialog box also allows you to create new configurations (modes) or to rename/delete existing configurations. The specifications of the different configurations can be modified by using the "Compile" and "Debug" tabs on the Project Properties window.

Hope that helps.

Cheers,
Randy
Apr 15 '11 #4
Hello again, Perry,

Incidentally, I should have also mentioned that when you have multiple projects within your solution, you can define solution configurations which specify different project configurations. That is, I can create a new configuration (called "MyMode", for example). Then in the "Solution Properties" dialog, by selecting "Configuration Properties+Configuration" in the left hand panel, I could set MyMode to have Project1 in DEBUG mode and project2 in RELEASE mode.

Cheers,
Randy
Apr 15 '11 #5
pod
298 100+
This was very informative. Using the drop-down will make the switching of database a little simpler.

If only I could set the IDE to switch itself to Release mode or at least to alert me to do so before I publish...

I'm not giving up yet, I'll do some more research

Thank you very much Randy for all your help.
Apr 18 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Claire | last post by:
How do I determine whether Im running in debug or release mode from code please. thanks Claire
2
by: JezB | last post by:
Any way I can programatically test whether my (c#) code is running in Debug or Release mode ? I want to load a smaller dataset when running in debug, for testing purposes.
2
by: Scott Yost | last post by:
I reference a .NET DLL to import some of my custom types. I can build that DLL in debug or release mode, but I usually keep the debug one built so I can debug it. When I want to link to the release...
3
by: John C Kirk | last post by:
I've come across an odd situation, where doing a floating point division produces different results for the same numbers. Basically, there are 4 ways to run this application: A) Debug build,...
4
by: Henry Padilla | last post by:
I found the following code snippet in the help but it doesn't seem to compile. Dim debugger As EnvDTE.Debugger Dim IsDebugging As Boolean debugger = DTE.Debugger If (debugger Is Nothing)...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
4
by: Donna | last post by:
I am attempting to build a web service in .NET 2.0, using Visual Studio 2005. I am able to build it in debug mode, but for deployment, I want to change to release mode. The problem is that there...
2
by: CtrlAltDel | last post by:
I have an ASP.NET application that runs just fine on our servers (Win2003, in dev/staging/prod) when the debug attribute of <system.web><compilation /></system.webis set to true, thusly: ...
7
by: news.microsoft.com | last post by:
I have an asp.net 2.0 project that when I change the build configuration to release I get the following error: Command line error BC2014: the value 'None' is invalid for option 'debug'. If I...
1
by: mamul | last post by:
Hi All, Could you please someone help me. Thanks in Advance. Actually My c++ application is running in debug mode with Visualstudio6.0 but NOT running in release mode. it showing that "oracle...
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
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.