I'm trying to convert a PCL to .NET Standard 1.3 and failing. I've narrowed the failure down to a really simple example that I can't understand why it's failing.
I have a class that implements IMarkupExtension
and simply compiling a project with just that class fails 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'.
Why on earth is it trying to pull in System.ComponentModel
for a Xamarin Forms library that's using .NET Standard? It makes no sense to me.
The project references are as simple as you can get:
The class implementation couldn't be any simpler:
namespace OpenNETCF
{
public sealed class ScaledDouble : IMarkupExtension
{
public object ProvideValue(IServiceProvider serviceProvider)
{
return null;
}
}
}
I can get rid of the compiler error by manually editing the project file to include System.ComponentModel
, but unsurprisingly the consuming app fails to load the type at runtime.
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="2.3.4.267" />
<!-- Required for IMarkupExtension and IServiceProvider to compile. No idea why. -->
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
</ItemGroup>
What's going on here??