Most Xamarin.Forms apps that have been in production for several years carry at least one binding project. It wraps a vendor's native Android .aar or iOS framework so C# can call it. Card readers, barcode scanners, mapping SDKs and BLE tooling are the usual cases.
The binding project is the part of the migration nobody can see in the UI. It is also where a build stalls for a week. This post is the order we work in.
Step 1: list every binding, and who owns it
Search the solution for projects that reference Xamarin.Android.Binding or contain Metadata.xml, ApiDefinition.cs and StructsAndEnums.cs. For each one, write down:
- the native library name and the exact version bound
- whether the binding came from the vendor, from a community NuGet, or from your own team
- whether the native SDK is still maintained and still builds against current Android and Xcode toolchains
Many Xamarin apps pull in a community binding NuGet that was never updated for .NET. Check the package's target frameworks. If it lists only MonoAndroid or Xamarin.iOS monikers, it will not restore into a net8.0-android or net8.0-ios project.
Step 2: look for a maintained .NET binding first
Before porting your own binding, check whether the vendor or a maintained community project already publishes one for net-android and net-ios. Google's Android libraries have maintained .NET packages for many artifacts. If one exists and covers the API surface you call, delete your binding project and take the package. That is the cheapest outcome.
Step 3: if you must keep your own binding, port the project file
An SDK-style binding project for .NET targets net8.0-android or net8.0-ios and replaces the old project format. Create a new project from the .NET Android or iOS binding library template, then move your files across:
- Android:
Transforms/Metadata.xml,EnumFields.xmlandEnumMethods.xml, plus the.aaror.jarasAndroidLibraryitems. - iOS:
ApiDefinition.csandStructsAndEnums.cs, plus the framework as aNativeReference.
Build it on its own before you wire it into the app. Expect the first build to fail on the generator, not on your code.
Step 4: the errors you will actually see
Android. The binding generator reports errors such as CS0534 (a generated class does not implement an inherited abstract member) or CS0111 for duplicate members. The fixes live in Metadata.xml: remove the offending member, rename it, or change its visibility. Also check the .aar dependencies. Older bindings relied on dependency NuGets such as the Xamarin.AndroidX packages. Use the current AndroidX binding packages so you do not ship two copies of the same library, which shows up as duplicate class errors at the Android build step.
iOS. Bindings against old static libraries often fail at link time. If the vendor ships an XCFramework, bind that and drop the fat .a file. Set Kind, SmartLink and any LinkerFlags in the NativeReference item to match what the native SDK needs, and check that it includes an arm64 simulator slice if you test on Apple silicon.
Step 5: check the native side against store rules
A binding keeps a native binary in your app, and the stores judge the binary. Two checks belong in the plan:
- Android: confirm the native
.sofiles in the.aarmeet the current Play requirements, including the 16 KB page-size alignment requirement for apps targeting recent Android versions. Check Google's current documentation for the date that applies to you. An old vendor SDK that is not aligned cannot be fixed from the C# side. - iOS: confirm the framework carries a privacy manifest and a signature where Apple requires them, again against Apple's current documentation.
If the vendor SDK is abandoned and fails these checks, the binding is not a porting problem. It is a replacement or retirement decision.
Step 6: decide between binding and a thinner option
A full binding exposes the entire native API. Often the app calls five methods. In that case consider a small native wrapper library, written in Kotlin or Swift, that exposes only those five. You then bind the wrapper, which is a much smaller Metadata.xml and ApiDefinition.cs to maintain. For a single iOS call the trade-off may favour a platform-specific partial class and no binding at all. The cost is a second language in the repository, and you should only accept it if a .NET developer on your team can read it.
Step 7: pin behaviour before you swap
Write a characterization test or a manual test script for each feature that crosses the binding: scan a barcode, pair a reader, render a map. Run it against the production Xamarin build and record results. Run it again against the migrated build. Binding regressions are rarely compile errors. They are threading differences, callback timing and nullability that the generator now surfaces differently.
What this costs
We do not quote binding work by count. A binding to a maintained SDK with a small surface can take an afternoon. One against an unmaintained vendor library with transitive dependencies can take weeks, and sometimes the honest answer is to remove the feature. We will not give an estimate until we have built the binding once.
Send us the repo
If you have a binding project that will not build, or a vendor SDK you cannot identify, send us the repo. You will get a written plan that says keep, rewrite or retire for each binding, with the risks that could stall a release. Start at Xamarin App Assessment or contact us.