Type 'XElement' is defined in an assembly that is not referenced.

During my process of loading the project from VS 2017 to 2019 i have encountered this error where i went to check if it has been added in the first place and i can assure you that it has.

This is the error

And here is the assembly being referenced.

Best Answer

  • AtanasAngelovAtanasAngelov ✭✭✭
    Accepted Answer

    I should have checked the version of the assembly as the one that i had referenced did not match the one that i needed

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    1.Try to delete the files in bin and obj on Xamarin.Forms and platform project. Then reload the project and test again.
    2. UnReload the project, open the csproj and add the following reference (in bold).

     <ItemGroup>
        <Reference Include="xxx" />
        ... 
      </ItemGroup>
    

    Check the link.

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    well i already tried all of them, but none of them have actually worked.

    Here is a segment of the Reference including the one that VS asked for but still the same error

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited October 17

    Try to add the references manually. Right click on References, click Add Reference and then select System.XML

    Refer to:
    https://stackoverflow.com/questions/31835615/getting-a-compile-error-in-c-sharp-about-not-referencing-system-xml-yes-system

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    I have removed the reference, saved the project, closed it, then i have opened it and manually added the reference, but that did not work.

  • JarvanJarvan Member, Xamarin Team Xamurai

    Have you tried to create a new project on VS 2019 and move the code to the new sample?

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    i can give that a try and see what will happen, so just taking the code and moving it to the new project while keeping the same name of the files from the previous project?

  • JarvanJarvan Member, Xamarin Team Xamurai

    Yes. Gook Luck! If it still no work, would you mind sharing a basic demo to reproduce the code? It'll help to get a solution.

  • AtanasAngelovAtanasAngelov Member ✭✭✭
    Accepted Answer

    I should have checked the version of the assembly as the one that i had referenced did not match the one that i needed

Sign In or Register to comment.