locked
Unable to add .NET class libraries to Store apps project

    Question

  • Hi,

    I am developing a Windows Store app to capture the live feed from webcam and show it in a CaptureElement control using MediaCapture API. However I am not able to add my existing project class libraries which are developed using .NET framework v4.5. I get the error:

    "The project targets .NET core while the file reference targets .NET framework. This is not a supported scenario".

    On searching in forums about it I found on converting to portable class libraries I will be able to add it. So I ended up converting my dll to PCL but found lot of base class libraries are not supported in PCL like System.Data.dll is not present. Also, the existing project references in that PCL should also be converted to PCL. So this is like an endless loop.

    Is there a workaround? Please suggest.

    Thanks in advance.

    Friday, February 27, 2015 4:48 AM

Answers

  • Just like Khanna mentioned, there isn't any workaround to use .NET framework 4.5 libraries in Windows Store app projects. But if you are very familiar with your libraries and reference libraries, you can find alternate libraries to create PCL assemblies for your Windows Store apps.

    With regards to System.Data.dll, this is typically used for database access. But in Windows Store apps, you can't use System.Data.dll. For local storage, you have the option of using SQLite which has the PCL libraries available for Windows Store apps. Also a more robust solution regarding database access would be to use Azure Mobile Services which also supports offline data sync.

    So depending on how complex your project and dependent assemblies are, you might consider slowly converting your assemblies to PCL compatible with Windows Store apps. You can also look in Nuget (Visual Studio -> Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution) to find similar libraries in your project that support Windows Store apps.

    Hope this helps.


    Abdulwahab Suleiman

    Friday, February 27, 2015 9:16 PM
    Moderator
  • No there is no workaround for this. Many classes in .NET Framework 4.5 like System.Data.dll are not available for Portable Class Library. 

    SQLite is one of the alternative for System.Data.dll. You would have to create a new library based on the classes available.


    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

    Friday, February 27, 2015 4:45 PM

All replies

  • No there is no workaround for this. Many classes in .NET Framework 4.5 like System.Data.dll are not available for Portable Class Library. 

    SQLite is one of the alternative for System.Data.dll. You would have to create a new library based on the classes available.


    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

    Friday, February 27, 2015 4:45 PM
  • Just like Khanna mentioned, there isn't any workaround to use .NET framework 4.5 libraries in Windows Store app projects. But if you are very familiar with your libraries and reference libraries, you can find alternate libraries to create PCL assemblies for your Windows Store apps.

    With regards to System.Data.dll, this is typically used for database access. But in Windows Store apps, you can't use System.Data.dll. For local storage, you have the option of using SQLite which has the PCL libraries available for Windows Store apps. Also a more robust solution regarding database access would be to use Azure Mobile Services which also supports offline data sync.

    So depending on how complex your project and dependent assemblies are, you might consider slowly converting your assemblies to PCL compatible with Windows Store apps. You can also look in Nuget (Visual Studio -> Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution) to find similar libraries in your project that support Windows Store apps.

    Hope this helps.


    Abdulwahab Suleiman

    Friday, February 27, 2015 9:16 PM
    Moderator