dotnet构建xamarin项目无法使用控制台

时间:2019-12-09 15:55:24

标签: c# .net xamarin asp.net-core azure-pipelines

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

我需要使用dotnet进行构建,因为azurepiple作业会使用它。

error

之后,当我在.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

有什么建议可以解决吗?

2 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:0)

尝试将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/"
相关问题