Debug and Release Versions in .NET
By: Steven Holzner in VB.net Tutorials on 2008-11-25
When starting programs from the Debug menu's Start item, Visual Basic launches the program while staying in the background; if there's a problem, Visual Basic will reappear to let you debug the program's code. That's useful for development, of course, but when your program is ready to go and to be used by others, you hardly want them to have to launch your program from Visual Basic.
That's where the difference between debug and release versions of your program comes in. In a debug version of your program, Visual Basic stores a great deal of data needed to interface with the debugger in your program when it runs, and this not only makes the corresponding assembly larger, but also slower. In the release version of your program, the program doesn't have all that added data, and can run as a stand-alone program, without needing to be launched from Visual Basic (although it still needs the .NET Framework, of course).
When you create a new solution, Visual Basic creates it in debug mode, meaning that you launch it from the Debug menu as we've been doing. However, you can switch to release mode in several ways (like many things in VB .NET, there's more than one way to do it):
-
Select the Configuration Manager item in the Build menu, then select Release in the Active Solution Configuration list box and click OK.
-
Select the solution you want to set the mode for by clicking it in the Solution Explorer, and find its Active Config property in the properties window. When you click the right-hand column in the properties window next to this property, a drop-down list box will appear; select Release in that list box.
-
Select the solution you want to set the mode for by clicking it in the Solution Explorer, and select the Properties item in the Project menu, opening the solution's property pages. Select the Configuration Properties folder in the box at left, and the Configuration item in that folder. Then select Release from the drop-down list box in the configuration column of the table that appears, and click OK.
-
Probably the easiest way to set the solution mode to release or debug is simply to use the drop-down list box that appears in the Visual Basic .NET standard toolbar, at the top of the IDE. When you create a new solution or project, this list box displays the word Debug, and all you need to do to switch to release mode is to select Release instead.
When you've set the mode for a solution to Release, you build it using the Build menu's Build item (the Build menu item causes Visual Basic to compile only items it thinks have been newly changed; to force it to compile all items in the solution, choose the Rebuild All item instead of Build). This builds the solution in a way that others can use it, and you can deploy your program this way (usually with the help of a deployment project that you build in Visual Basic).
Add Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- Android
- React Native
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Changes in Controls from VB6 to VB.net
Unstructured Exception Handling in VB.net
Structured Exception Handling in VB.net
Creating Sub Procedures in VB.net
Passing a Variable Number of Arguments to Procedures in VB.net
Specifying Optional Arguments with default values in Procedures in VB.net
Preserving a Variable's Values between Procedure Calls in VB.net
Throwing an Exception in VB.net
Comments