thudugala / Plugin.LocalNotification

The local notification plugin provides a way to show local notifications from .Net MAUI and Xamarin Forms apps .
MIT License
401 stars 66 forks source link

Release Build fails on .NET 8 #459

Closed ahwm closed 4 months ago

ahwm commented 6 months ago

Describe the bug Oddly, it builds/publishes fine for iOS.

/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/targets/Microsoft.Android.Sdk.ILLink.targets(106,5): error MSB4096: The item "Plugin.LocalNotification" in item list "TrimmerRootAssembly" does not define a value for metadata "RootMode". In order to use this metadata, either qualify it by specifying %(TrimmerRootAssembly.RootMode), or ensure that all items in this list define a value for this metadata. [/path/to/project.csproj::TargetFramework=net8.0-android]

Same error on Visual Studio 2022 on Windows:

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.43\targets\Microsoft.Android.Sdk.ILLink.targets(106,5): error MSB4096: The item "Plugin.LocalNotification" in item list "TrimmerRootAssembly" does not define a value for metadata "RootMode". In order to use this metadata, either qualify it by specifying %(TrimmerRootAssembly.RootMode), or ensure that all items in this list define a value for this metadata.

To Reproduce dotnet publish project.csproj -f net8.0-android -c Release

Attempt to build release Android with .NET 8

Expected behavior Build successfully

Platform (please complete the following information):

Additional context .NET 8.0.100

ahwm commented 6 months ago

Further searching found this: https://github.com/dotnet/sdk/issues/27492

So I tried a couple of different values and this ended up working:

    <ItemGroup>
        <TrimmerRootAssembly Include="Plugin.LocalNotification" RootMode="library" />
    </ItemGroup>
thudugala commented 4 months ago

also try version 11.0.1-preview02

VinShen commented 3 months ago

@ahwm

Using 11.1.1 Nuget Version on Android OS 14

tried for Release version with AOT and Enable Trimming and

    <ItemGroup>
    <TrimmerRootAssembly Include="Plugin.LocalNotification" RootMode="library" />
</ItemGroup>

The App does build and run but Local Notification events are not fired.

With AOT and Enable Trimming both false, Local Notification works good in Release mode.

Am I missing something?