You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET7迁移至.NET8后MAUI Android打包报错的解决咨询

MAUI项目从.NET7迁移至.NET8后打包Google Play报错的修复方案

问题详情

将MAUI项目从.NET7迁移到.NET8后,打包部署到Google Play时出现两个构建错误:

error MSB4064: The "AndroidFixManifests" parameter is not supported by the "XamarinDownloadArchives" task loaded from assembly: Xamarin.Build.Download, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null from the path: C:\Users\enric.nuget\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.dll. Verify that the parameter exists on the task, the points to the correct assembly, and it is a settable public instance property.

error MSB4063: The "XamarinDownloadArchives" task could not be initialized with its input parameters.

查看项目依赖的Xamarin.Build.Download.targets文件,发现其中的_XamarinBuildDownloadCore目标传递了AndroidFixManifests参数:

<Target Name="_XamarinBuildDownloadCore"
        Condition="'@(XamarinBuildDownload)'!=''">

    <XamarinDownloadArchives
        AllowUnsecureUrls="$(XamarinBuildDownloadAllowUnsecure)"
        Archives="@(XamarinBuildDownload)"
        DestinationBase="$(XamarinBuildDownloadDir)"
        CacheDirectory="$(XamarinBuildDownloadDir)"
        User7ZipPath="$(XamarinBuildDownloadUser7ZipPath)"
        VsInstallRoot="$(VsInstallRoot)"
        IsAndroid="$(_XamarinBuildDownloadIsAndroid)"
        AndroidFixManifests="$(_XamarinBuildDownloadAndroidFixManifests)"
        />
</Target>

解决方法

  • 更新Xamarin.Build.Download包:当前使用的0.11.4版本不支持AndroidFixManifests参数,而.NET8的MAUI构建逻辑会自动传入该参数。将包更新到0.12.0及以上版本,新版本已适配该参数。
  • 临时移除参数传递(不推荐):若暂时无法更新包,可手动修改Xamarin.Build.Download.targets文件,删除AndroidFixManifests="$(_XamarinBuildDownloadAndroidFixManifests)"这一行;或者在项目的.csproj中添加配置,禁用该参数:
    <PropertyGroup>
      <_XamarinBuildDownloadAndroidFixManifests>False</_XamarinBuildDownloadAndroidFixManifests>
    </PropertyGroup>
    
    注意:此方法为临时方案,后续包更新会覆盖修改,优先选择更新包。
  • 清理NuGet缓存并重新还原:更新包后,执行以下命令清理缓存并重新还原依赖,避免旧版本文件残留:
    dotnet nuget locals all --clear
    dotnet restore
    

内容的提问来源于stack exchange,提问作者Enrico

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 12:03:41