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

  • Question

  • User2953 posted

    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.

    Monday, August 28, 2017 3:26 PM

Answers

  • User129559 posted

    System.ComponentModel is a NuGet package in some NetStandard versions.

    Install it and it should work.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, August 28, 2017 4:32 PM

All replies

  • User129559 posted

    System.ComponentModel is a NuGet package in some NetStandard versions.

    Install it and it should work.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, August 28, 2017 4:32 PM
  • User39869 posted

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

    Friday, November 17, 2017 4:02 PM
  • User355961 posted

    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.

    Saturday, December 23, 2017 2:38 PM
  • User303504 posted

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

    Friday, January 19, 2018 7:09 PM
  • User339690 posted

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

    Sunday, April 22, 2018 8:08 PM
  • User359605 posted

    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

    Monday, December 3, 2018 5:49 PM
  • User76049 posted

    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?

    Monday, December 3, 2018 6:28 PM