Q:

Could not AOT assembly - When building Xamarin Android project using MSBUILD on Windows

I am building a Xamarin.Android in release mode using an automated build using Azure DevOps
I have AOT turned on with LLVM turned on (I know previously AOT was "Experimental" but I think its not production ready)
I can build my project locally but when using MSBuild I get the following errors:

C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  System.Data.DataSetExtensions.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  Xamarin.Forms.GoogleMaps.Android.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  CarouselView.FormsPlugin.Android.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly: Syncfusion.Core.XForms.dll
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly: Plugin.Messaging.dll
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  Syncfusion.DocIORenderer.Portable.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  SQLitePCLRaw.provider.e_sqlite3.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  Syncfusion.DataSource.Portable.dll C:\Program Files (x86)\Microsoft
  Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly:
  Microsoft.AppCenter.Analytics.Android.Bindings.dll C:\Program Files
  (x86)\Microsoft Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly: Plugin.CurrentActivity.dll
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2730,3):
  Error XA3001: Could not AOT the assembly: SQLite-net.dll

The crux of this error is:

Could not AOT the assembly: AssemblyX.dll

I have tried building on a hosted VM too and I get the same error.
So where does the root cause of this error lie, is it Visual Studio? Xamarin? The Individual Libraries or My Project?

A:

This turned out to be just one assembly causing the error:

System.Data.DataSetExtensions.dll V4.5.0

Found here: https://www.nuget.org/packages/System.Data.DataSetExtensions/4.5.0
After refactoring that library out my solution built fine.
You can track this issue here: https://github.com/xamarin/xamarin-android/issues/2751

