473,382 Members | 1,420 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.

Debug.Print Release ?

Hello,
I have a VB 2005 Express project with a TraceListener-derived class to
route Debug.Print output to a log file. It works fine for Debug builds.
What is the correct combination of changes to make it work in Release
build?
Bill

Jan 4 '06 #1
6 4082
Bill,
Rather then attempt to expose the Debug object for Release builds, I would
recommend you use Trace.Print instead. As the Trace object is normally
enabled in Release builds, while Debug is only enabled in Debug builds.

If you really want the Debug object in Release Builds you can use "Project -
Properties - Compile - Advanced Compile Options - Define DEBUG constant" to
define the DEBUG compile time constant.

NOTE: "Define DEBUG constant" will enable all conditional code that uses the
Debug constant. Whether this code is using #if Debug or
<Conditional("Debug")>

FWIW: The System.Diagnostics.Debug (Debug.Print) has a
<Conditional("Debug")> attribute on it, you can apply the same attribute to
your code to achieve the same effect...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
<sw************@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
| Hello,
| I have a VB 2005 Express project with a TraceListener-derived class to
| route Debug.Print output to a log file. It works fine for Debug builds.
| What is the correct combination of changes to make it work in Release
| build?
| Bill
|
Jan 4 '06 #2
2 things:

1 In "Project - Properties - Compile", I see no "Advanced Compile
Options"

2 The IDE informs me that Print is not a member of Trace

Bill

Jay B. Harlow [MVP - Outlook] wrote:
Bill,
Rather then attempt to expose the Debug object for Release builds, I would
recommend you use Trace.Print instead. As the Trace object is normally
enabled in Release builds, while Debug is only enabled in Debug builds.

If you really want the Debug object in Release Builds you can use "Project -
Properties - Compile - Advanced Compile Options - Define DEBUG constant" to
define the DEBUG compile time constant.

NOTE: "Define DEBUG constant" will enable all conditional code that uses the
Debug constant. Whether this code is using #if Debug or
<Conditional("Debug")>

FWIW: The System.Diagnostics.Debug (Debug.Print) has a
<Conditional("Debug")> attribute on it, you can apply the same attribute to
your code to achieve the same effect...

--
Hope this helps
Jay [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
<sw************@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
| Hello,
| I have a VB 2005 Express project with a TraceListener-derived class to
| route Debug.Print output to a log file. It works fine for Debug builds.
| What is the correct combination of changes to make it work in Release
| build?
| Bill
|


Jan 4 '06 #3
| 1 In "Project - Properties - Compile", I see no "Advanced Compile
| Options"
VS 2005 correct? "Advance Compile Options" is a huge button just below the
build output path, just above the All configurations text on the Compile
tab. The third "line" from the top.

(I'm expecting VS 2005 as Debug.Print is new in 2005).

| 2 The IDE informs me that Print is not a member of Trace
My mistake: Try Trace.WriteLine instead... Or possibly Trace.TraceWarning,
TraceError, or TraceInformation.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
<sw************@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
|2 things:
|
| 1 In "Project - Properties - Compile", I see no "Advanced Compile
| Options"
|
| 2 The IDE informs me that Print is not a member of Trace
|
| Bill
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Bill,
| > Rather then attempt to expose the Debug object for Release builds, I
would
| > recommend you use Trace.Print instead. As the Trace object is normally
| > enabled in Release builds, while Debug is only enabled in Debug builds.
| >
| > If you really want the Debug object in Release Builds you can use
"Project -
| > Properties - Compile - Advanced Compile Options - Define DEBUG constant"
to
| > define the DEBUG compile time constant.
| >
| > NOTE: "Define DEBUG constant" will enable all conditional code that uses
the
| > Debug constant. Whether this code is using #if Debug or
| > <Conditional("Debug")>
| >
| > FWIW: The System.Diagnostics.Debug (Debug.Print) has a
| > <Conditional("Debug")> attribute on it, you can apply the same attribute
to
| > your code to achieve the same effect...
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > <sw************@yahoo.com> wrote in message
| > news:11**********************@g47g2000cwa.googlegr oups.com...
| > | Hello,
| > | I have a VB 2005 Express project with a TraceListener-derived class to
| > | route Debug.Print output to a log file. It works fine for Debug
builds.
| > | What is the correct combination of changes to make it work in Release
| > | build?
| > | Bill
| > |
|
Jan 4 '06 #4
Hello,
For some reason, my copy of VB 2005 Express has no "Advance Compile
Options" button. Is it an IDE configuration issue?
Bill

Jan 4 '06 #5
<sw************@yahoo.com> schrieb:
For some reason, my copy of VB 2005 Express has no "Advance Compile
Options" button. Is it an IDE configuration issue?


The Express editions come with a "streamlined" UI, so maybe that's why the
option is missing :-(.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 4 '06 #6
Ah! There's the Rub.

I'm using VS.NET 2005 Professional!

I don't have 2005 Express loaded to see what the UI looks like there. As
Herfried suggests, the option may not be available.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
<sw************@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
| Hello,
| For some reason, my copy of VB 2005 Express has no "Advance Compile
| Options" button. Is it an IDE configuration issue?
| Bill
|
Jan 5 '06 #7

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

Similar topics

10
by: Bhavna Rohra | last post by:
Hello everyone, Sorry, it might sound easy for everyone but please if someone colud tell me how to debug my MFC application in Release mode. Thanks
3
by: Tim Marshall | last post by:
For an mdb or mde release, does having debug.print without the comment single quote add any processing time to the application? I assume an mde won't since debug.prints would not be compiled in...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
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...
7
by: Thomas Pecha | last post by:
Sorry for all who think this is easy, I was not able to handle this Coming from VB6 where with simple debug.print strAString you could write to debug window, I am totalling failing in vb.net...
12
by: Micah | last post by:
I am looking for a way to tell if the program is compiled in debug mode, I want the application I am writing to spit out a message to QA if a error occured and if it is in debug mode, but if it is...
9
by: David A. Beck | last post by:
When I do a debug.print("blabla") in VB (VS2005) it doesn't show up in the output window, what gives?
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:...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
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: 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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.