繁体   English   中英

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

[英]dotnet build xamarin project fails using console

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

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

错误

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

<MSBuildExtensionsPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild</MSBuildExtensionsPath>

错误变化:

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

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

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

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

尝试将TargetFrameworkRootPath设置为安装 xamarin 的位置。

<TargetFrameworkRootPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\</TargetFrameworkRootPath>

或在命令行上

dotnet build -clp:ErrorsOnly -p:MSBuildExtensionsPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild"/ -p:TargetFrameworkRootPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/ReferenceAssemblies/Microsoft/Framework/"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM