locked
Universal Apps - Shared Or Portable Class Library?

    Question

  • I'm playing around with the new Universal Apps setup and all the examples that I'm seeing use a Shared project.
    Previously, it seems that Portable Class Libraries were the preferred way to build Windows 8/Windows Phone 8 apps.

    Are PCLs "so last year" or are there times when it would be better to use them?
    I noticed that there is a Class Library project (seemingly the same as Portable Class Libraries).
    JJ

    Saturday, April 05, 2014 10:42 PM

Answers

  • They are both useful for different things. Portable class libraries are .Net libraries and are great for sharing .Net code across projects. They can't call non-.Net classes like the Windows Runtime. The shared project can call the Windows Runtime for both Windows Store and Windows Phone and is more of a replacement for linking files between Phone and Store projects.

    The Class Library project is different from the Portable Class Library in that it targets a single version of the .Net Framework rather than being portable across multiple profiles.

    --Rob

    Saturday, April 05, 2014 11:49 PM
    Owner
  • I dont think PCL as so last year because they allow you to share code with xamarin for ios and android
    Sunday, April 06, 2014 12:48 PM
  • I see the Shared as the shared for UI : converters, some XAML, etc. But I will still use the PCL projects for ViewModels, core component like storage etc. that I can use in others projects or I want to unit test.

    The main obstacle for PCL right now is the lack of nugget package supporting the profile wp8.1 but it's easy to workaround since you can reference directly a WinRT dlls.


    http://wp7wonders.wordpress.com/

    Sunday, April 06, 2014 3:41 PM

All replies

  • They are both useful for different things. Portable class libraries are .Net libraries and are great for sharing .Net code across projects. They can't call non-.Net classes like the Windows Runtime. The shared project can call the Windows Runtime for both Windows Store and Windows Phone and is more of a replacement for linking files between Phone and Store projects.

    The Class Library project is different from the Portable Class Library in that it targets a single version of the .Net Framework rather than being portable across multiple profiles.

    --Rob

    Saturday, April 05, 2014 11:49 PM
    Owner
  • I dont think PCL as so last year because they allow you to share code with xamarin for ios and android
    Sunday, April 06, 2014 12:48 PM
  • I see the Shared as the shared for UI : converters, some XAML, etc. But I will still use the PCL projects for ViewModels, core component like storage etc. that I can use in others projects or I want to unit test.

    The main obstacle for PCL right now is the lack of nugget package supporting the profile wp8.1 but it's easy to workaround since you can reference directly a WinRT dlls.


    http://wp7wonders.wordpress.com/

    Sunday, April 06, 2014 3:41 PM