Can't use IMarkupExtension in a .NET Standard library?!

I'm trying to migrate a PCL to .NET Standard (1.3) and classes inheriting from IMarkupExtension fail to compile with:

The type 'IServiceProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I've got more detail on the project here:
https://stackoverflow.com/questions/45922394/iserviceprovider-not-available-in-net-standard

But reproducing this can be done with a project with one class. What's going on here? It makes no sense.

Tagged:

Best Answer

Answers

  • Steven123Steven123 GBMember ✭✭

    Nope its still not working:
    xamarinForms v2.5.0.9163, system.ComponentModel v4.3.0,
    netstandard 1.4/1.6/2.0

  • DanNordquistDanNordquist USMember ✭✭

    Installing system.ComponentModel v4.3.0 broke everything... had to uninstall it.

    Has anyone found a resolution to this? I can't use embedded images in a .net standard without IServiceProvider and since Microsoft is killing off PCL we HAVE to move to .net standard.

  • AliKahaeiAliKahaei USMember ✭✭

    It didn't work for me either. Need help!

  • EltonSantanaEltonSantana USMember ✭✭

    It didn't work for me too. I'm using .NET Standard 2.0.

  • ClubberLangClubberLang BEMember ✭✭

    We are in December and I still have the same issue, look :

    https://stackoverflow.com/questions/53583423/xamarin-migration-to-net-standard-2-0-failed

    I find no way to solve it ! If someone has an idea ?

    Thanks

  • NMackayNMackay GBInsider, University mod

    This definitely works, tested with Forms 3.2-3.4 with .NETStandard 2.0. Something we use use in production code.

    Have you deleted all obj & bin in the solution, clear packages, obliterated your nuget cache and rebuilt the .NETStandard lib 1st?

Sign In or Register to comment.