dotnet build xamarin 项目使用控制台失败

cm4*_*m44 4 .net c# xamarin asp.net-core azure-pipelines

当我尝试使用 dotnet 构建我的 .csproj 文件时,它会向我抛出一个错误,但是当我在 Visual sutido 2019 上构建项目时就可以了。

我需要使用 dotnet 构建,因为 azurepiple 工作使用它。

错误

之后,当我将 .csproj 中的路径参数设置为这些时:

<MSBuildExtensionsPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild</MSBuildExtensionsPath>
Run Code Online (Sandbox Code Playgroud)

错误变化:

The reference assemblies for MonoAndroid,Version=v1.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Run Code Online (Sandbox Code Playgroud)

有什么建议可以解决它吗?

Stu*_*art 7

您现在需要使用msbuild(如msbuild MySolution.sln)来构建 Xamarin 项目。

您可以使用 构建单个netstandard2.x项目dotnet build,但是需要使用构建基于 Mono 的平台项目(即 Android 和 iOS 项目)msbuild