Search code examples
.netvisual-studio-2012windows-phone-8visual-studio-2013libsvm

'incompatible assembly' error while adding DLL reference to Windows Phone 8 Project


Preface: I am new to Windows phone app development. I was trying to add libsvm to implement classification for my app. I found this git hub repository: https://github.com/ccerhan/LibSVMsharp.

I tried to install it using nuget Package Manager console as instructed, the console said that it was added successfully but the references in my project have no LibSVMsharp. So I tried to manually add reference but an error appeared saying:

a reference to higher version or incompatible assembly cannot be added to the project VS windows phone

(When I tried to install the package to visual studio for windows desktop it got added in the references, but I want to develop windows phone app).


Solution

  • Unfortunately Windows Phone does not allow all Libraries to be used. The Runtime only allows Portable class libraries (PCL). You could check if you could port the code from github to a portable class library. This could be possible if the library only uses references to these assemblies:

    mscorlib.dll
    System.dll
    System.Core.dll
    System.Xml.dll
    System.ComponentModel.Composition.dll
    System.Net.dll
    System.Runtime.Serialization.dll
    System.ServiceModel.dll
    System.Xml.Serialization.dll
    System.Windows.dll (from Silverlight)
    

    (source msdn)

    See link about portable class libraries

    Edit To answer, it is NOT possible to port this code to a PCL since System.Data is not usable there