我在我的安卓设备上调试我的毛伊岛应用程序没有问题,但当我试图发布它时,我得到了一个错误.我正在使用Visual Studio社区2022 17.5.1.以下是输出中不好的部分:

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

请帮帮忙,不知道该怎么办. PS:在我的项目中,我使用Plugin.Maui.Audio和社区工具包

推荐答案

您可以try 以下步骤:

1.try 删除每个平台的obj个文件夹和bin个文件夹,然后重建

2.如果您的构建过程单独提供了assembly个信息,这可能会导致重复,因为您的项目在AssemblyInfo.cs文件中也有该信息.因此,请try 删除文件AssemblyInfo.cs.

您可以try 使用AssemblyInfo.cs文件来关闭自动部件信息生成,如下所示:

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

这里有一个类似的帖子,你可以参考Duplicate AssemblyVersion Attribute条.

Android相关问答推荐

如何正确增加LazyStream中的变量

合成 colored颜色 的GSON反序列化

无法在Android Gradle中同步Chaquopy版本

从安卓S原生库的资源中读取json文件

Modifer.Align()不适用于行/列/框中的文本.未解决的作用域实例错误

Android-LVL库始终返回NOT_SUBLISTED

数据绑定在Android中等待填充值时显示未填充的值

如何在DownloadManager Android中显示ProgressBar和Complete Listener

如何在Jetpack Compose中向SearchBar添加边框

弹出导航堆栈后,Compose 无法访问 Hilt View Model

布局可组合项如何具有可测量和约束参数?

Android 不在后台更新位置

发布 MAUI 应用程序时出现遇到重复程序集错误

服务似乎在启动时忽略传递的变量

是否可以在 Kotlin 中为 mutableStateOf() 设置自定义设置器

在compose中,为什么修改List元素的属性,LazyColumn不刷新

Jetpack compose 为网络检索视频帧导致延迟

在 Kotlin 中循环遍历字符串并用新行替换句号

Android Studio Emulator Internet 连接问题仅是第一次

CenterAlignedTopAppBar 滚动行为:未为参数状态传递值