【问题标题】:dotnet build xamarin project fails using consoledotnet build xamarin 项目使用控制台失败
【发布时间】:2019-12-09 15:55:24
【问题描述】:

当我尝试使用 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

有什么解决办法吗?

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      尝试将 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/"
      

      【讨论】:

        猜你喜欢
        • 2023-04-09
        • 1970-01-01
        • 1970-01-01
        • 2022-01-20
        • 1970-01-01
        • 2011-06-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多