Getting error: The type 'Object' is defined in an assembly that is not referenced

SreeeeSreeee INMember ✭✭✭✭✭
edited January 2019 in Xamarin.Forms

I am converting my PCL project to .Net Standard project using this article. But getting the following error when building.

I try adding netstandard reference like below from this thread, but no luck.

  <ItemGroup>
    <Reference Include="netstandard" />
  </ItemGroup>
  <ItemGroup>

Complete Error details

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, >Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

Please suggest any solution for this problem?

Best Answer

  • JohnHJohnH GB ✭✭✭✭✭
    Accepted Answer

    Easiest option I found was just to add a new .net standard project and move the files.

Answers

  • JohnHJohnH GBMember ✭✭✭✭✭
    Accepted Answer

    Easiest option I found was just to add a new .net standard project and move the files.

  • SreeeeSreeee INMember ✭✭✭✭✭

    @JohnHair said:
    Easiest option I found was just to add a new .net standard project and move the files.

    Initially, I got another error from windows part.
    Error details:

    Severity Code Description Myproject File Line Suppression State
    Error NU1201 Project Myproj is not compatible with uap10.0.10586 (UAP,Version=v10.0.10586) / win10-arm-aot. >Project Myproject supports: netstandard2.0 (.NETStandard,Version=v2.0) Myproject.UW

    Choosing the Windows 10 Fall Creators Update for both Target and Min version for my UWP app solved the above problem. I got this from here. Is that fix affect the current error?

  • LandLuLandLu Member, Xamarin Team Xamurai

    Yes, for using .NET Standard 2.0 in UWP, we need to target Fall Creators Update (FCU) as the minimum version of your UWP project. That’s because .NET Standard 2.0 contains many APIs that require FCU to make them work in the context of the UWP execution environment.
    Then what do you mean

    Is that fix affect the current error?

  • SreeeeSreeee INMember ✭✭✭✭✭

    @LandLu I am asking the fix was done in UWP(changing the target and Min version) affect the current issues in any way?

  • LandLuLandLu Member, Xamarin Team Xamurai

    @Sreeee Congratulations that you have fixed this error. Do you have any other issues here?

  • SreeeeSreeee INMember ✭✭✭✭✭

    @LandLu

    I have not solved this issue. Leave this issue for now because I have created a new project and added all the files into it.

    So can you suggest any solution for this issue? This is a show stopper issue for me.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @Sreeee I think we'd better finish this thread firstly, then discuss other issues at your another thread.

Sign In or Register to comment.