Is code within an #if DebugBuild block included in the built app?

To make my life easier, I currently pre-populate some password fields in my app when it is run in the debugger by enclosing the code like this:

#if DebugBuild then

To prevent these passwords shipping, I’ve been commenting this code before building a shipping version of my app. But I have been wondering whether I need to do this, because perhaps code within a block such as this is excluded from a non-debug build?

It’s checked at build time. If it doesn’t work out to be true, the section is skipped and not included in the build.

Thanks Tim!

Is there any way to make it true for COMPILING… so I can continue to see my debug pieces in the live compiled app for testing??

Just invert the boolean operation.

#if not DebugBuild then

[quote=366576:@Tim Parnell]Just invert the boolean operation.

#if not DebugBuild then


#If DebugBuild Then
'DEBUG ONLY CODE. won't compiled in builds only on debug builds (via the run button).

'BUILD APPLICATION CODE, will only be inside actual builds (via the build button).

#end if

OK yes I realize I can do these types of things but was wondering if there was a way to simple set the DebugBuild to true somehow without editing the code.

I can do a global replace and THEN put it back when I am ready to release to the public…



Create a constant that evaluates to true.

#if MyConstant then //Do some debug reporting here #endif

When you’re done with your work simply make the constant false and recompile. I do this a fair bit.