Closed Iron2213 closed 9 months ago
Looks like you need to add the RootMode
attribute/metadata to the TrimmerRootAssembly
element.
Here is a link to the list of valid values https://github.com/dotnet/runtime/blob/89f7ad3b276fb0b48f20cb4e8408bdce85c2b415/src/tools/illink/src/linker/Linker/AssemblyRootMode.cs#L6
Or do like the message says and try.
<TrimmerRootAssembly Include="System.Private.CoreLib" RootMode="%(TrimmerRootAssembly.RootMode)"/>
Adding did <TrimmerRootAssembly Include="System.Private.CoreLib" RootMode="%(TrimmerRootAssembly.RootMode)"/>
resolve the issue, thank you!
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
.NET 8, VS2022 17.8.7
Description
I'm trying to upgrade my Android APP to .NET 8 from .NET 7. I can successfully compile and run the application in debug mode without any problem, but when i try to build in release mode i get the following error:
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.ILLink.targets(106,5): error MSB4096: The item "System.Private.CoreLib" 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.
The error is repeated 4 times in the output section.
I have no Nuget packages to update (not counting preview updates).
This is my current .csproj file:
Steps to Reproduce
Unable to reproduce with new .NET 8 application.
Did you find any workaround?
Setting "PublishTrimmed" to false resolves the issue but creates a much bigger APK when archiving.
Relevant log output