Error CS0012: You must add a reference to assembly netstandard, Version=2.0.0.0, Culture=neutral

KeithBoyntonKeithBoynton GBMember ✭✭

Since updating to the latest stable builds which were released recently I'm seeing a new error in an area of code that hasn't been changed recently.

Current versions:
Visual Studio Community 2019 for Mac Version 8.1.1 (build 27) === Apple Developer Tools === Xcode 10.2.1 (14490.122) Build 10E1001 === Xamarin.Mac === Version: 5.10.0.157 (Visual Studio Community) Hash: 6bd94753 Branch: d16-1 Build date: 2019-06-12 17:28:48-0400 === Xamarin.iOS === Version: 12.10.0.157 (Visual Studio Community) Hash: 6bd94753 Branch: d16-1 Build date: 2019-06-12 17:28:47-0400 Xamarin extensions: 5104b76623e0df8e5f763f87d170279c0b788e89 === Operating System === Mac OS X 10.14.5 Darwin 18.6.0 Darwin Kernel Version 18.6.0 Thu Apr 25 23:16:27 PDT 2019 root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

The error I'm seeing during build is:
Error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral

After some research I discovered an old Xamarin bugzilla case contributed to by @ChrisHamons that suggested a "hack" of adding the following reference to the project file:
<Reference Include="netstandard" />

My project is a Xamarin.Mac modern project and that "hack" does show as an error in the references but the project builds and runs just fine.

Does anyone know if there is a better resolution to this other than the hack?

Posts

Sign In or Register to comment.