If NETFX_CORE is for Windows 8, what is for Windows Phone 8?

Jerry Nixon picture Jerry Nixon · Nov 27, 2012 · Viewed 8.5k times · Source

I understand using the NETFX_CORE directive, like this:

#if NETFX_CORE 
    // Windows 8
#else 
    // Windows Phone 8
#endif

More info: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714084(v=vs.105).aspx

But is there a directive specific to Windows Phone 8?

Answer

Jennifer Marsman - MSFT picture Jennifer Marsman - MSFT · Nov 28, 2012

Yes, the Windows Phone directive is:

#if WINDOWS_PHONE

This is documented here, but I'm surprised that it isn't mentioned here. I also tested this in some code, and it works.