2

I have no problems debugging my MAUI app on my Android device but when i try to publish it i get an error. I am using Visual Studio Community 2022 17.5.1. Here's the bad portion of output:

Duplicate 32-bit hash 0x2159891885 encountered for assembly Microsoft.Maui
Duplicate 32-bit hash 0x2159891885 encountered for assembly Microsoft.Maui
Duplicate 32-bit hash 0x2159891885 encountered for assembly Microsoft.Maui
Duplicate 32-bit hash 0x3800979733 encountered for assembly Microsoft.Maui.Controls.Compatibility
Duplicate 32-bit hash 0x3800979733 encountered for assembly Microsoft.Maui.Controls.Compatibility
Duplicate 32-bit hash 0x3800979733 encountered for assembly Microsoft.Maui.Controls.Compatibility
Duplicate 32-bit hash 0x2758225723 encountered for assembly Microsoft.Maui.Controls.Xaml
Duplicate 32-bit hash 0x2758225723 encountered for assembly Microsoft.Maui.Controls.Xaml
Duplicate 32-bit hash 0x2758225723 encountered for assembly Microsoft.Maui.Controls.Xaml
Duplicate 32-bit hash 0x2480646305 encountered for assembly Microsoft.Maui.Controls
Duplicate 32-bit hash 0x2480646305 encountered for assembly Microsoft.Maui.Controls
Duplicate 32-bit hash 0x2480646305 encountered for assembly Microsoft.Maui.Controls
Duplicate 32-bit hash 0x2861189240 encountered for assembly Microsoft.Maui.Essentials
Duplicate 32-bit hash 0x2861189240 encountered for assembly Microsoft.Maui.Essentials
Duplicate 32-bit hash 0x2861189240 encountered for assembly Microsoft.Maui.Essentials
XABLD7009: System.InvalidOperationException: Duplicate assemblies encountered

Please help, have no idea what to do. PS: in my project i use Plugin.Maui.Audio and Community Toolkit

Mike Tsayper
  • 1,686
  • 1
  • 17
  • 25

1 Answers1

1

You can try the following steps:

1.try to delete the obj folders and bin folders of every platform, then rebuild it

2.if your build process provides assembly information separately which may cause a duplication as your project also has that info in the AssemblyInfo.cs file. So try to remove file AssemblyInfo.cs.

and you can try to use the AssemblyInfo.cs file is to turn off automatic assembly info generation like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>
</Project>

And there is a similar thread here, you can refer to Duplicate AssemblyVersion Attribute.

Jessie Zhang -MSFT
  • 9,830
  • 1
  • 7
  • 19