locked
Compiler directives using portable class library across platforms? RRS feed

  • Question

  • I am re-using code through a portable class library (PCL) across Metro and Wpf app.

    Depending on which platform the PCL is loaded into (Metro/Wpf) I need to include different namespaces like:

    #if METRO
    using Conditional.Namespace;
    #elif WPF
    using Another.Namespace;
    #endif

    How could this be done..?

    Monday, February 3, 2014 10:39 PM

Answers

  • It cannot. The point of a portable class library is that it contains only portable code.

    You cannot put WPF or Windows Store specific code in a Portable Class Library. You would put that code in non-portable libraries which could then call into the PCL.

    --Rob

    • Marked as answer by Southbranch Tuesday, February 4, 2014 9:35 AM
    Tuesday, February 4, 2014 12:34 AM
    Moderator

All replies

  • It cannot. The point of a portable class library is that it contains only portable code.

    You cannot put WPF or Windows Store specific code in a Portable Class Library. You would put that code in non-portable libraries which could then call into the PCL.

    --Rob

    • Marked as answer by Southbranch Tuesday, February 4, 2014 9:35 AM
    Tuesday, February 4, 2014 12:34 AM
    Moderator
  • I understand and it make sense in some way.

    I wanted to double check, so manythanks.

    Tuesday, February 4, 2014 9:35 AM