简体   繁体   中英

Xamarin iOS Could not AOT the assembly Microsoft.EntityFrameworkCore.Migrations.Migration

We've added migrations to our xamarin forms project and ever since then we can't deploy it to an iOS device. It will run on the simulator fine but will fail with AOT errors on deploying to device.

It seems to be a fairly wide spread topic over the web but none of the ideas so far have made a difference. We're using EntityFrameworkCore v2.2.6 along with xamarin.forms v4.1.0.

I've tried adding the -v -v -v for more details on the build log but still just get:

Error       Could not AOT the assembly '/Users/MyUser/Library/Caches/Xamarin/mtbs/builds/MyCompany.Mobile.iOS/8fcd0a31c7f6e1a671890e2462fe729f/obj/iPhone/Debug/mtouch-cache/3-Build/MyCompany.Data.Persistence.dll'    MyCompany.Mobile.iOS    

Any ideas what else I should try?

I haven't try these but it could fix your issue

  • IOS Build -> General -> and uncheck the option Incremental Build.
  • Disable LLVM.
  • Remove all unnecesary classes, methods from your MyCompany.Data.Persistence.dll so it wont generate heavy code.
  • Change Linking to Link All Assemblies

Xamarin.Android applications use a linker to reduce the size

The default value is SdkOnly

None : No linking will be attempted.

SdkOnly : Linking will be performed on the base class libraries only, not user's assemblies.

Full: Linking will be performed on base class libraries and user assemblies. For more details refer here.. Note: if you are facing an issue with linking such as "GetAdditionalResourcesFromAssemblies" task failed unexpectedly. System.IO.FileNotFoundException: . Perhaps it doesn't exist in the Mono for Android profile?

then recheck your xamarin.Android project settings and set the below tag,

true

It Should Solve Your Problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM