Well, it looks like UWP and .NET Core projects can use the same project.json. Its "frameworks" section looks like:
"frameworks": {
"netstandard1.3": {},
"uap10.0": {
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
}
}
},
Because UWP project has its own csproj file, this leads to building 3 DLLs: project.json causes netstandard1.3 and uap10.0 folders appear in bin/Debug (and places resulting DLLs there) when building .NET Core project while UWP project itself builds yet another DLL right in bin/Debug.
bin/Debug/uap10.0/My.dll is garbage, it cannot contain any UWP-specific code (because Universal Windows reference is not available in .NET Core projects) and therefore I don't define WINDOWS_UWP in project.json's "uap10.0" part.
However, UWP csproj file does define WINDOWS_UWP, and Universal Windows is available in that project. So, when UWP project gets built, it in fact uses only this:
"uap10.0": {
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
},
(if this code is missing in project.json, UWP project won't build). The rest of project.json (mostly specific to "netstandard1.3" target) makes no harm for the build process.
So I'm relying on the fact that I can define conditional directives (WINDOWS_UWP in this case) not only in project.json but in csproj file as well and thus achieve extra results when processing UWP project which uses the same project.json file as .NET Core project. To some extent, UWP csproj acts as another project.json which is merged with the real one during the building process.
Yes, I'm getting an extra DLL bin/Debug/uap10.0/My.dll which is of no use (just a waste of compiler time) but I'll then pick only those outputs which are useful for me so it's not a problem in my particular case.