Reputation: 1994
Is there an easy way to install the CommonServiceLocator nuget package to a .NET Standard 1.4 project in visual studio 2017?
Installing the nuget package fails with:
Package CommonServiceLocator 1.3.0 is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Package CommonServiceLocator 1.3.0 supports: portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328) One or more packages are incompatible with .NETStandard,Version=v1.4.
Upvotes: 0
Views: 959
Reputation: 100581
NuGet packages that are compatible with a PCL can usually be used by using the PackageTargetFallback
property in the csproj file like this:
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wpa81+wp8</PackageTargetFallback>
</PropertyGroup>
Note that in .NET Standard 2.0 / .NET Core 2.0 tooling, this is changing to AssetTargetFallback
but should no longer be necessary since .NET Standard and .NET Core 2.0 are automatically compatible with packages that work on .NET 4.6.1.
Upvotes: 1