Forum Xamarin.iOS

Unable to find System types when building Xamarin iOS project

eli_beli_b Member ✭✭

I'm building a multi-platform class library with Xamarin. The Android project builds with no problem. But the iOS project gives me a bunch of errors like this, for various System types:

error CS0012: The type 'System.IDisposable' is defined in an assembly that is not referenced. Consider adding a reference to assembly 'netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

This happens regardless of whether I build via Visual Studio, or on the command line with msbuild.

My .csproj has these framework references and package references:

  <Reference Include="System" />
  <Reference Include="System.Xml" />
  <Reference Include="System.Core" />
  <Reference Include="System.Net.Http" />
  <Reference Include="Xamarin.iOS" />
  <PackageReference Include="Common.Logging" Version="3.4.1" />
  <PackageReference Include="Xamarin.Essentials" Version="0.8.0-preview" />
  <PackageReference Include="Xam.Plugin.DeviceInfo" Version="" />
  <PackageReference Include="My.Other.Library" Version="1.0.2" />

Note that My.Other.Library is not an iOS project; it has targets of netstandard1.4, netstandard1.6, netstandard2.0, and net45. I'm guessing that that is not the problem, because the same library is also used by my Android project, which works fine.

Currently these two projects have the same code - that is, they both compile the same .cs files from a shared directory, except for AssemblyInfo.cs which exists separately in each project. They also have the same assembly references, except that the Android project uses Mono.Android rather than Xamarin.iOS.

I'm using Mac Visual Studio Community 7.5.2.

Any ideas?


  • ColeXColeX Member, Xamarin Team Xamurai

    Can you delete <PackageReference Include="My.Other.Library" Version="1.0.2" to test if error still exists?

  • eli_beli_b Member ✭✭

    Indeed, it looks like the error only happens if I have the My.Other.Library reference. Every one of the errors I'm seeing is on a line where it refers to some type from My.Other.Library, and the error always complains about not being able to find some System type that that type refers to - for instance, if my type implements IDisposable it will say it can't find IDisposable, and if there's nothing like that, it will say it can't find the base class Object.

    But why this particular package should cause so much confusion for my iOS package - and only for iOS, not for Android - I have no idea.

Sign In or Register to comment.