Why NET_2_0 is not defined when compiling scripts under Unity editor in UWP

When Universal Windows Platform is selected in Unity Editor with Api Compatibility Level NET 2.0, Unity compiles scripts without specifying NET_2_0 (or NET_2_0_SUBSET) macro.

This is problematic for our plugin (NoesisGUI) as we have to declare some missing classes in NET 2.0, only for that framework level, so we can be compatible with scripts working under NET 4.6. As the macro is not defined these classes are not defined and our plugin scripts can’t compile, making impossible to play scenes when UWP platform is selected, or to generate UWP projects.

When a platform that uses mono is selected this works fine as NET_2_0 (or NET_2_0_SUBSET) macro is correctly defined.

Is this a bug or does it have an explanation?

Are you targeting .NET Scripting backend? If so, it ignores Api Compatibility Level as .NET scripting backend only has one API set: “.NET Core for UWP”. See this: