简体   繁体   English

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

[英]dotnet build xamarin project fails using console

when i try to build my .csproj file with dotnet it throws to me an error, but when i build project at visual sutido 2019 its ok.当我尝试使用 dotnet 构建我的 .csproj 文件时,它会向我抛出一个错误,但是当我在 Visual sutido 2019 上构建项目时就可以了。

I need to build with dotnet because azurepiple job use it.我需要使用 dotnet 构建,因为 azurepiple 工作使用它。

error错误

after, when i set path param in my .csproj to these:之后,当我将 .csproj 中的路径参数设置为这些时:

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

errors change:错误变化:

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

Any suggestions to solve it?有什么建议可以解决它吗?

You'll need to use msbuild (like msbuild MySolution.sln ) to build a Xamarin project today.您现在需要使用msbuild (如msbuild MySolution.sln )来构建 Xamarin 项目。

You can build the individual netstandard2.x projects using dotnet build , however the Mono based platform projects (ie the Android and iOS projects) need to be built using msbuild .您可以使用dotnet build构建单独的netstandard2.x项目,但是需要使用msbuild dotnet build基于 Mono 的平台项目(即 Android 和 iOS 项目)。

Try setting the TargetFrameworkRootPath to where you have xamarin installed.尝试将TargetFrameworkRootPath设置为安装 xamarin 的位置。

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

or on the command line或在命令行上

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