You must add a reference to assembly 'System.Xml.Linq, Version=4.0.0.0, culture = neutral,

I created a portable Library project in visual studio which contains a class and method for parsing XML Document. I created a Mono.Android project in the same Solution and referencing the Portable Library project by Mono.Android project. In my Android Project I am calling the method for Which I Written to Parse XML document. I am Passing XDocument object as a parameter to that method. But I am getting error : Error 1)The type 'System.Xml.Linq.XDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\Users\pruthviraj\Documents\Visual Studio 2013\Projects\Xamarin\KernelTesting\MainActivity.cs 55 21 KernelTesting.
Please any one helpme. Thanks

Posts

  • TsovakTsovak USMember

    I too have a few days looking for a solution of the problem ((

  • Did any one find the solution for this. I am stuck on this

  • TorbenKruseTorbenKruse DEMember ✭✭✭

    Add the reference to your android project if you want to pass a XDocument. Right click on references -> add -> System.Xml.Linq.

  • ravensorbravensorb USMember ✭✭

    Any update to this? I am getting this all of the time for both Droid and IOS projects on Windows using VS2015 RC on Windows 8.1, Windows 10, and Server 2012 R2

    Note: Importing the Facades (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facade) does help temporarily solve the issue -- however if I update an package, those are removed at the problem returns.

  • David_PilkingtonDavid_Pilkington USUniversity

    I am also having this issue

  • scotch83scotch83 BEMember

    I am also having the same issue with a third party library.
    As I already have the library in the references, I checked its version (by right click -> Properties on the reference you want to check) and find out that my version is older than the one needed.
    Now the question is: if I add a new one, will the code written for the old one still work?
    I have System.Xml version 2.0.5.0 and need 4.0.0.0
    Let you know if I find something else out.

  • NoxalusNoxalus USMember ✭✭

    I have the same problem here. I use a library that have the version 4.0.0.0 of System.Xml (.NET 4.5) and my Android project (MonoAndroid) seems to have the version 2.0.5.0 only in its assembly, so it doesn't match. :disappointed:

    Do you have any solution for this problem?

  • NoxalusNoxalus USMember ✭✭
    edited October 2016

    What I've done to resolve the problem was to update the library that I use to instanciate an XmlReader from a Stream instead of a file path, so I can do something like that:

    foreach (var source in Assets.ListFile(@"Content/XML"))
    {
        var filename = @"Content/XML/" + source;
        var stream = Assets.Open(filename);
        ParseStream(filename, stream);
    }
    
Sign In or Register to comment.