问题
Potential DUPLICATE EF.Core 2.0.1 Unsafe in Xamarin.Android Except targeting 8.0 not 7.1 and dotnet version 2.1.4 is loaded.
Using VS 2017 version 15.5.7 to test Entity framework in Xamarin forms The UWP project. Dont have a mac to test the IOS version.
The droid version dies with the output below The key points from proj.cs file are
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite">
<Version>2.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="2.5.0.280555" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="25.4.0.2" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="25.4.0.2" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="25.4.0.2" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="25.4.0.2" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="25.4.0.2" />
03-07 18:19:02.011 D/Mono ( 5003): Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'. 03-07 18:19:02.011 F/monodroid-assembly( 5003): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration. 03-07 18:19:02.011 F/monodroid-assembly( 5003): This might be due to an invalid debug installation. 03-07 18:19:02.011 F/monodroid-assembly( 5003): A common cause is to 'adb install' the app directly instead of doing from the IDE.
Is this issue still not resolved ? dev com post
Is there a sample that works on Net standard 2.0 and Android 8.0?
回答1:
We had the same issue, this will resolve it:
- Go to C:\Users\Your User Name.nuget\System.Runtime.Compilerservies.Unsafe\4.4.0\ and delete the ref folder
- Copy the lib folder and rename it to ref
- Cleanup your Project and Build it
来源:https://stackoverflow.com/questions/49158090/entityframework-and-xamarin-forms-net-standard-2-0-assembly-load-issue