参考CommonServiceLocator .NET Standard 1.4上的Nuget

问题描述:

是否有一种简单的方法将CommonServiceLocator nuget包安装到Visual Studio 2017中的.NET Standard 1.4项目中?参考CommonServiceLocator .NET Standard 1.4上的Nuget

安装NuGet包失败:

包CommonServiceLocator 1.3.0不与 netstandard1.4(.NETStandard,版本= V1.4)兼容。软件包 CommonServiceLocator 1.3.0支持:portable-net40 + sl5 + win8 + wp8 + wpa81 (.NETPortable,Version = v0.0,Profile = Profile328)一个或多个软件包 与.NETStandard版本= v1.4不兼容。

+0

一般的共识是,你不应该使用CommonServiceLocator或任何关于DI包含的抽象。阅读[this](http://blog.ploeh.dk/2011/07/28/CompositionRoot/)和[this](http://blog.ploeh.dk/2014/05/19/di-friendly-library /)。 – Steven

的NuGet包是与PCL兼容,通常可以通过在文件的csproj像这样使用PackageTargetFallback property使用:

<PropertyGroup> 
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wpa81+wp8</PackageTargetFallback> 
</PropertyGroup> 

注意,在.NET 2.0标准/ .NET 2.0的核心工具,这将更改为AssetTargetFallback,但应该不再需要,因为.NET Standard和.NET Core 2.0会自动与.NET 4.6.1上的软件包兼容。