By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

Debug.Print Release ?

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
| 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

P: n/a
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

P: n/a
<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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.