gpt4 book ai didi

xamarin.forms - 如何在 Visual Studio for Mac 中设置 AutoGenerateBindingRedirects?

转载 作者:行者123 更新时间:2023-12-04 05:46:36 25 4
gpt4 key购买 nike

我目前正在开发一个名为 ABCD 的 Xamarin.Forms 项目,使用 macOS Sierra v10.12.6 和 Visual Studio (VS) for Mac v7.3.2(设置步骤详细 here)。

成功设置后,我继续如下:

  • 右键单击主项目文件夹,我选择 选项 .
  • 构建 , 在 一般 , 下 目标框架 : .NET 便携版:PCL 4.5 - Profile111 已为我自动选择。
  • 我将其切换到其正上方的选项: .NET 标准平台:netstandard1.5 ;然后选择 好的 .
  • 切换这个框架后,我重建项目。重建后出现警告:

  • Warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. (MSB3276) (ABCD.iOS)


  • 所以也许这是因为 NETStandard.Library 包已过期。
  • 在主套餐 文件夹,右键单击 NETStandard.Library 说版本 1.6.0 , 但输入 dotnet --version 进入 终端显示 2.1.3 ,所以我更新 NETStandard.Library 在 VS 中 – 接受出现的许可证。
  • 重建后相同的警告仍然存在。
  • 所以我转到警告提供的 Microsoft 链接并关注他们的 instructions添加 <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>到各种 .csproj 文件。
  • 我将此添加到主 .csproj 文件中,重建项目并收到相同的警告。
  • 我将此添加到 iOS 和 Android .csproj 文件中,重建项目并收到相同的警告。

  • 那么这是什么问题,为什么会如此顽固,如果我不理会它会给我带来多大的麻烦?

    最佳答案

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>我的经验是我们需要 <AutoGenerateBindingRedirects>成为 true .
    我的开发环境:

  • macOS Mojave 10.14.2 (18C54)
  • VisualStudio for Mac 专业版 7.7.4(内部版本 1)

  • #解决方案:
    我所做的是按照以下 MS Doc( link ) 中给出的说明进行操作。
  • 卸载 MyBeautifulApp.Xamarin.iOS.csproj来自 Visual Studio Xamarin Forms 解决方案。
  • 编辑 MyBeautifulApp.Xamarin.iOS.csproj使用 TextEdit 手动创建文件并添加以下行<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>到与您尝试构建并给出错误的构建配置相关的 PropertyGroup。
  • 保存 .csproj文件。然后关闭文件并在 VS 解决方案资源管理器中重新加载项目。
  • 然后清理并尝试构建,它应该成功构建而不会给出任何警告或错误。 -----> 对我来说这有效。

  • 注:我编辑了 .csproj仅限我的 Xamarin.Forms iOS App 项目的文件。因为 Xamarin.Forms 解决方案中的 Android 项目已经成功构建。
    编辑完我的 MyBeautifulApp.Xamarin.iOS.csproj手动文件看起来如下:
    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{asdf-7AC6-asdf-9890-asdf}</ProjectGuid>
    <ProjectTypeGuids>{asdfasd-340asdf5-455asdfC-asdf-asdf};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>MyBeautifulApp.Xamarin.iOS</RootNamespace>
    <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
    <AssemblyName>MyBeautifulApp.Xamarin.iOS</AssemblyName>
    <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    **<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>**
    </PropertyGroup>
    <PropertyGroup>
    ....For another build configuration related property group...
    更多信息:现在我的问题是我是否应该对与其他 Build 配置相关的 .iOS.csproj 文件的所有其他 PropertyGroup 进行此更改?我很高兴从外面的人那里知道。但现在我决定不碰那些,直到它在 future 给我一个警告/错误。
    希望这对那里的任何人都有帮助。

    关于xamarin.forms - 如何在 Visual Studio for Mac 中设置 AutoGenerateBindingRedirects?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48069346/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com