Conditional Compilation in VB.Net - Hilton Giesenow's Jumbled Mind

Hilton Giesenow's Jumbled Mind

the madness that is...

News

This is my little spot in cyberspace where you will find a collection of random (but mostly software-related) thoughts and ideas that are frightening in their shining brilliance (or something like that ;->).
 
Please enjoy your stay and feel free to Contact Me.
 
Microsoft MVP

.Net Links

BlogRoll

Misc. Links

Syndication

Conditional Compilation in VB.Net

So I'm browsing the MSDN library, like one does of an afternoon, and I see the section on #If...Then...#Else Directives. Apparently it existed in the vb6 days, too, but I somehow missed this one. It obviously functions similarly to a regular If .. Then .. Else in terms of conditional logic but the difference is that it is a compile-time directive. What this means is that you can actually compile different physical versions of your product based on different conditions (e.g. debug vs. release).

[update: Rocky Lhotka put up a nice post recently about A scary way to do conditional compilation - an interesting read]

Posted: Feb 03 2005, 03:49 PM by hiltong | with 2 comment(s)
Filed under:

Comments

Armand said:

Yes, and define your own configurations. Especially useful for possibly including unit tests in a build or not etc.
# February 3, 2005 4:35 PM

Xyon75 said:

these directives are local to each module (or class, form, ...). Anyone knows if in vbnet there's also a way to declare public compilate directives?

# October 23, 2008 7:38 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: