• Question

  • I have a Universal App in which I need to do a small amount of conditional compilation. I tried to use WINDOWS_APP and WINDOWS_PHONE_APP with #If statements, but they did not seem to work. Are these constants not getting defined? What do I need to do include conditional compilation for Windows vs Windows Phone apps? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Saturday, November 22, 2014 8:34 PM

All replies

  • Hi Nathan,

    when you create a Universal App with the Blank-App-Template, you can already see the WINDOWS_PHONE_APP-symbol in use in the App.xaml.cs-file:

        public sealed partial class App : Application
            private TransitionCollection transitions;

    The symbols are defined in the Properties of each project under the Build-tab. Here the build tab of a Windows Phone project in a universal app:

    So it should work by default. :-)

    Thomas Claudius Huber

    "If you can't make your app run faster, make it at least look & feel extremly fast"

    My latest Pluralsight-course: Windows Store Apps - Data Binding in Depth

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    Saturday, November 22, 2014 10:50 PM
  • I am using VB.NET, so I do not have a Universal App Template available for me. I tried manually adding WINDOWS_PHONE_APP & WINDOWS_APP to the custom constants as follows:

    But that did not help. Is there something else I need to do? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, November 23, 2014 3:19 AM