Reputation: 439
I'm trying to add a reference to the package PCLCrypto (2.0.147) in a project using NetStandard 1.3
After I add the import "portable-net45+netcore45+wpa81" in the project.json, it builds, but keep showing the errors.
project.json:
{
"supports": {},
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.1.1",
"NETStandard.Library": "1.6.1",
"PCLCrypto": "2.0.147",
"System.ComponentModel.Primitives": "4.1.0",
"WraUtil.Helpers": "1.8.2"
},
"frameworks": {
"netstandard1.3": {
"imports": "portable-net45+netcore45+wpa81"
}
}
}
errors:
Severity Code Description Project File Line Suppression State
Error Package PInvoke.NCrypt 0.3.2 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PInvoke.NCrypt 0.3.2 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net40+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile92)
- portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
Error Package Validation 2.2.8 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package Validation 2.2.8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-dnxcore50+monoandroid10+monotouch10+net45+win+wp8+wpa81+xamarinios10 (.NETPortable,Version=v0.0,Profile=net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
Error Package PCLCrypto 2.0.147 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PCLCrypto 2.0.147 supports:
- monoandroid23 (MonoAndroid,Version=v2.3)
- monotouch10 (MonoTouch,Version=v1.0)
- net45 (.NETFramework,Version=v4.5)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32)
- wp8 (WindowsPhone,Version=v8.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
Error One or more packages are incompatible with .NETStandard,Version=v1.3.
Error Package PCLCrypto 2.0.147 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PCLCrypto 2.0.147 supports:
- monoandroid23 (MonoAndroid,Version=v2.3)
- monotouch10 (MonoTouch,Version=v1.0)
- net45 (.NETFramework,Version=v4.5)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32)
- wp8 (WindowsPhone,Version=v8.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
Error One or more packages are incompatible with .NETStandard,Version=v1.3.
Error Package Validation 2.2.8 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package Validation 2.2.8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-dnxcore50+monoandroid10+monotouch10+net45+win+wp8+wpa81+xamarinios10 (.NETPortable,Version=v0.0,Profile=net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
Error Package PInvoke.NCrypt 0.3.2 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PInvoke.NCrypt 0.3.2 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net40+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile92)
- portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
Do I need to configure anything else?
Upvotes: 1
Views: 1053
Reputation: 3476
In the imports
field in your project.json
file, you should put a target framework which is compatible with PCLCrypto 2.0.147, and those errors are basically telling you which options you have.
For example, one of those supported target frameworks is portable-net45+win8+wp8+wpa81
which is compatible with netstandard1.0
, which means that it can be also referenced by a netstandard1.3
project (you can find here more info about compatibility between the old PCL profiles and new .NET Standard versions).
So, update your imports
field to: "imports": "portable-net45+win8+wp8+wpa81"
.
Small bonus - in case you decide to move from project.json
to new MSBuild (csproj) style projects, you can achieve the same with:
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback>
</PropertyGroup>
Upvotes: 2