TargetConsole but not TargetWeb

When I use:

#If TargetConsole Then
…
#EndIf

it runs the enclosed code when run in a WebApp. Now I understand that behind the scenes a WebApp is a console app, but I wouldn’t have thought it would go as far as calling itself a Console target. What is the best way around this for Console-only code? Is this it:

#If TargetConsole And Not TargetWeb Then
…
#EndIf

That would work

1 Like