C# UWP中缺少ServiceContainer

C# UWP中缺少ServiceContainer,c#,class,uwp,portable-class-library,C#,Class,Uwp,Portable Class Library,我正在UWP中转换一个应用程序,但找不到System.ComponentModel.Design.ServiceContainer类。要翻译的代码是: if (serviceProvider == null) { ServiceContainer container = new ServiceContainer(); container.AddService(typeof(MyInterface), this); serviceProvider =

我正在UWP中转换一个应用程序,但找不到
System.ComponentModel.Design.ServiceContainer
类。要翻译的代码是:

if (serviceProvider == null)
{           
    ServiceContainer container = new ServiceContainer();
    container.AddService(typeof(MyInterface), this);
    serviceProvider = container;
}
return serviceProvider;

是否有类似的功能或解决方法?

应用程序的原始类型是什么?wpf?@NuwanKarunarathna是的,是wpf。我发现了这个,但我不确定它是否有效,我还没有测试过。我选择了一种不同的软件体系结构,直到.NETCore2才添加,所以您必须至少调整项目中的版本。以下是您在VS2017中调出它时的版本信息:microsoft.netcore.universalwindowsplatform\6.0.5\ref\uap10.0.15138