Greg Finzer
Greg Finzer

Reputation: 7074

Is there a compiler constant for Windows Runtime?

Is there a specific compiler constant for WinRT similar to the compiler constant of SILVERLIGHT and WINDOWS_PHONE?

Example:

#if SILVERLIGHT

#if WINDOWS_PHONE

Upvotes: 2

Views: 571

Answers (2)

Matt Johnson
Matt Johnson

Reputation: 1931

WINAPI_PARTITION_APP and WINAPI_PARTITION_DESKTOP are the two built in #defines I use. here is a line to MSDN with more information:

EDIT: the answer in this SO question also has some relevant info:

EDIT: for C# you can use NETFX_CORE (sorry missed the tag in the question). You need to make sure this is configured in VisualStudio's build tab:

enter image description here

Upvotes: 2

chue x
chue x

Reputation: 18823

The constant that is defined in Windows Store C# projects is NETFX_CORE. So you could do this:

#if NETFX_CORE
    // Windows Store Apps, Windows Runtime stuff
#end

Upvotes: 2

Related Questions