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

Azure DevOps Pipeline生成APK时出现XALNK7000错误求助

问题:Azure DevOps Pipeline构建Xamarin.Android项目时出现XALNK7000错误

本地Visual Studio 2022中项目可正常构建运行,但在Azure DevOps Pipeline执行生成APK脚本时,出现如下XALNK7000错误:

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(660,5):
Error XALNK7000: Mono.Linker.MarkException: Error processing method:
'System.Threading.Tasks.Task1<Sharpnado.HorizontalListView.Services.PageResult1>
Sharpnado.HorizontalListView.Paging.Paginator1::LoadPage(System.Int32,System.Boolean)' in assembly: 'Sharpnado.HorizontalListView.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task1<!0>
Sharpnado.Tasks.TaskMonitor1<Sharpnado.HorizontalListView.Services.PageResult1>::get_Task()

使用的YAML脚本如下:

# https://docs.microsoft.com/azure/devops/pipelines/languages/xamarin
pool:
  vmImage: 'windows-2019' # For Mac, use 'macOS-10.13'

variables:
  - group: 'AndroidAppVariables'
  - name: 'buildConfiguration'
    value: 'Release'
  - name: 'outputDirectory'
    value: '$(build.binariesDirectory)/$(buildConfiguration)'
  - name: 'NugetVersion'
    value: 5.8.0

steps:
- task: NuGetToolInstaller@0
  displayName: 'Use NuGet $(NugetVersion)'
  inputs:
    versionSpec: $(NugetVersion)

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: 'src\AndroidApp.sln'
    feedsToUse: 'select'
    vstsFeed: '/a3sb3q3s-ab12-2020-0202-0202020202'

- task: XamarinAndroid@1
  inputs:
    projectFile: 'src\AndroidApp.Android\AndroidApp.csproj'
    outputDirectory: '$(outputDirectory)'
    configuration: '$(buildConfiguration)'
    jdkVersionOption: 1.11
    createAppPackage: true
    msbuildVersionOption: latest

已尝试以下方案但未解决问题:

  • 确认Sharpnado.HorizontalListView并非当前项目依赖(可能曾是历史依赖)
  • 从Android.csproj文件中移除<GenerateSerializationAssembles>Auto</GenerateSerializationAssemblies>配置
  • 将项目文件路径中的反斜杠\改为正斜杠/
  • 重新安装部分NuGet包
  • 将项目的Linking属性设置为None

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.27 15:02:23