Clarification on iOS .NET linker settings

I have a question regarding the documentation in regards to using Linking in .NET under iOS. Specifically, the documentation states the following:

For iOS, it is important to ensure that the project Linker Behavior should be set to either Link SDK assemblies only or Don’t Link. Using Link all assemblies can result in runtime failure.

This is unfortunate as it can result in the filesize becoming severely bloated depending on what ther libraries you are using.

However, it seems that the documentation may be incomplete. In my tests, it seems that you are able to use Link All without any issues if you set up a linkskip CLI option or use a custom linker description file (see my working example linker file below). The linkskip/config causes the linker to NOT link any referenced assemblies.

There doesn’t seem to be any reason why this won’t work and in all my tests, it does seem to be perfectly fine. I just want to make sure I’m not missing anything. Thank you in advance for any insight.

<linker>
	<assembly fullname="SQLite-net">
		<type fullname="*" />
	</assembly>

	<assembly fullname="SQLitePCLRaw.batteries_v2">
		<type fullname="*" />
	</assembly>

	<assembly fullname="SQLitePCLRaw.core">
		<type fullname="*" />
	</assembly>

	<assembly fullname="SQLitePCLRaw.lib.sqlcipher">
		<type fullname="*" />
	</assembly>

	<assembly fullname="SQLitePCLRaw.provider.internal">
		<type fullname="*" />
	</assembly>
</linker>

Hello @UIJ - thank you for writing in about this. You are correct, you should be able to use the linker file to exclude those specific assemblies. We will update the documentation to reflect this as an option.

1 Like

Appreciate you taking the time to respond.