Although you do not need to use conditional code blocks in PowerBuilder .NET to reference .NET classes as in PowerBuilder Classic, you can still use the PBDOTNET and DEBUG preprocessor symbols for conditional compilation in PowerBuilder .NET targets.
PowerBuilder .NET also recognizes the PBWPF preprocessor symbol, which lets you conditionally code blocks of script exclusively for WPF Window Application targets. The code in these blocks is not parsed for other target types that share objects with WPF Window Application targets.
PowerBuilder .NET processes code inside PBDOTNET code blocks for WPF Window Application, NVO .NET Assembly, WCF Service, and PB Assembly targets. When the Enable Debug Symbol check box is selected in the Project painter, PowerBuilder .NET also processes code that is bracketed by the DEBUG preprocessor symbol.
PowerBuilder .NET ignores all code in PBNATIVE, PBWINFORM, PBWEBSERVICE, and PBWEBFORM code blocks in the targets that you migrate from PowerBuilder Classic. The conditional code blocks in migrated targets are kept in place, and enabled only for those symbols that are valid in PowerBuilder .NET.
PowerBuilder .NET can process code in blocks with the NOT operator, even if the preprocessor symbol used is not normally valid in PowerBuilder .NET targets. You can also enable invalid code blocks in migrated applications by changing the preprocessor symbols to symbols that are valid for your current target.
For more information on conditional compilation, see Referencing .NET Classes in PowerScript in the PowerBuilder Classic HTML help.
Some preprocessor use cases in PowerBuilder .NET include:
#if Defined NOT PBNATIVE then /// code will be executed #end if
#if Defined PBWINFORM /// code will be ignored #elseif defined PBWEBFORM then /// code will be ignored #else /// code will be executed #end if
#if Defined PBWPF then /// code will be executed #end if