如果没有任何代码更改,Android 的管道构建就会失败并出现以下错误。
/opt/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Linux/33.0.95/tools/Xamarin.Android.Tooling.targets(70,5): error XA5300: The Android SDK directory could not be found. Install the Android SDK by following the instructions at: https://aka.ms/dotnet-android-install-sdk [/home/vsts/work/1/s/App/App.csproj::TargetFramework=net7.0-android]
/opt/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Linux/33.0.95/tools/Xamarin.Android.Tooling.targets(70,5): error XA5300: To use a custom SDK path for a command line build, set the 'AndroidSdkDirectory' MSBuild property to the custom path. [/home/vsts/work/1/s/App/App.csproj::TargetFramework=net7.0-android]
##[error]Error: The process '/opt/hostedtoolcache/dotnet/dotnet' failed with exit code 1
- task: DotNetCoreCLI@2
displayName: 'Install MAUI workload'
inputs:
command: 'custom'
custom: 'workload'
arguments: 'install maui-android'
- task: DotNetCoreCLI@2
displayName: 'Build Solution'
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/*.sln'
arguments: '-f:net7.0-android -c:Release /p:BuildAndroidOnly=true'
我们昨天出现了完全相同的错误,我们开始失败的构建使用的是新的 dotnet 版本 (7.0.405)。 如果您的管道也配置为默认使用最新版本,我相信它现在会失败。 我们更改了管道以专门使用较旧的 dotnet 7.0.404,现在它再次成功构建
- task: DotNet@2
inputs:
version: 7.404