xamarin-macios
xamarin-macios copied to clipboard
.NET: Unify the MtouchLink and LinkMode MSBuild properties
We have the MtouchLink property for Xamarin.iOS and the LinkMode property for Xamarin.Mac.
We should unify these for .NET.
Options:
- Use
LinkModefor both. - Come up with a different name (ideas? Android uses
AndroidLinkMode).
I think LinkMode is good enough for us (we're already using it anyway).
CC @jonathanpeppers: maybe this is something we should coordinate with Android as well?
We still have $(AndroidLinkMode), but then also newer linker settings:
https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNet.md#linker-illink
SdkOnly for Android is the same as:
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
AndroidLinkMode=Full sets TrimMode="link" on every assembly, and there isn't a new linker setting for this.
It seems like Full isn't highly used, but maybe we should ask someone involved with mono/linker if they would add some property for all platforms for this?
Even though . NET probably came up with the names after xamarin and mono, we should probably use their names? At least maybe use them as the main public options and then use the platform specific ones for finer or advanced control?
They are working on new cross-platform names here:
- https://github.com/dotnet/linker/pull/2856
- https://github.com/xamarin/xamarin-android/pull/7132
TrimMode=partial is SdkOnly and TrimMode=link is Full.
I think we should just make it where you could use either the old or new names.
After a talk about this, I believe this is the path forward:
- Recommend using
TrimModestarting in .NET 7 for everybody. - Make the old
MtouchLink/LinkModeproperties keep working as-is (whereTrimModetakes precedence if it's set).