I have developed an simple .net Standard-Library.
then I referenced this assembly in an .net 4.6 Project which basically works fine.
But when I try to call a method in this .net Standard-library with an bool (or Guid)-parameter I'm getting this error:
Cannot convert source type 'bool [mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]' to target type 'bool [System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]'
These Types are defined in both-assemblies: mscorlib and System.Runtime...how can I fix this?
UPDATE
here is an very simple example to Show this error:
.net Portable Library --> converted to .NET Standard via the property-tab
public class MyClass
{
public void CallMe(Guid guid)
{
//so something
}
}
Project.json
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {}
}
}
I also had to add this to my csproj-File, outerwise it doesn't work at all:
<PropertyGroup>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
net 4.6.1 Project (referenced the .net Standard-library directly via the dll-file (Project-reference is not working)
public class Class1
{
private void Call()
{
var c = new MyClass();
c.CallMe(Guid.NewGuid());
}
}
And that is the error-message:

@Jon Skeet Thank you for your help.
The problem was an incompatibility between the .net Framework-Version and the .NET Standardversion.
The list can be found here: https://learn.microsoft.com/en-us/dotnet/articles/standard/library
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With