Skip to content

.NET 6 + $(BundleAssemblies)=True is broken #7764

@jonpryor

Description

@jonpryor

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.2+

Description

.NET Android dropped support for $(BundleAssemblies)=True; see also:

However, this deprecation never made it to the build system. Now, if you build a .NET 6+ app with $(BundleAssemblies) set, the app is broken.

See also: https://discord.com/channels/732297728826277939/732297837953679412/1071145486695792761

The problem is likely due to: https://github.com/xamarin/xamarin-android/blob/47a1df7b6911dc30b52164766984d3ed3c4f004e/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L336

wherein $(AndroidUseAssemblyStore)=False when $(BundleAssemblies)=True.

We should not support $(BundleAssemblies)=True. Rather, the problems are:

  • No warning is emitted to mention that $(BundleAssemblies) is not supported, and
  • the resulting .apk is broken and doesn't work.

Steps to Reproduce

% dotnet new android -n android-ba
% cd android-ba
% dotnet build -p:BundleAssemblies=true
# run the app, or just look at the .apk contents
% unzip -l bin/Debug/net7.0-android/*-Signed.apk | grep assem
      660  02-03-2023 14:13   assemblies/rc.bin

Note that there is no assemblies/assemblies.blob file (c927026).

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions