如何在Mac的Visual Studio中设置AutoGenerateBindingRedirects? [英] How to Set AutoGenerateBindingRedirects in Visual Studio for Mac?

查看:351
本文介绍了如何在Mac的Visual Studio中设置AutoGenerateBindingRedirects?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用macOS Sierra v10.12.6和Visual Studio(VS)for Mac v7.3.2(名称为ABa的Xamarin.Forms项目)进行工作(详细设置步骤

I'm currently working on a Xamarin.Forms project named ABCD, using macOS Sierra v10.12.6 and Visual Studio (VS) for Mac v7.3.2 (the set up steps are detailed here).

设置成功后,我将继续进行以下操作:

Having successfully set that up, I continue as follows:

  • 右键单击主项目文件夹,选择选项.

Build 下的 General 下的 Target Framework 下: .NET Portable:PCL 4.5-Profile111 已自动为我选择.

Under Build, in General, under Target Framework: .NET Portable: PCL 4.5 - Profile111 has been automatically selected for me.

我将其切换到其上方的选项: .NET Standard Platform:netstandard1.5 ;然后选择确定.

I switch this to the option right above it: .NET Standard Platform: netstandard1.5; then select OK.

切换此框架后,我将重建项目.重建后,出现警告:

After switching this framework, I rebuild the project. After the rebuild, a warning appears:

警告MSB3276:发现相同从属程序集的不同版本之间存在冲突.请在项目文件中将"AutoGenerateBindingRedirects"属性设置为true.有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkId=294190 . (MSB3276)(ABCD.iOS)

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 包已过期.

    • So maybe this is because the NETStandard.Library package is out-of-date.

      在主 Packages 文件夹中,右键单击 NETStandard.Library ,显示版本为 1.6.0 ,但键入将dotnet --version 转换为 Terminal 会显示 2.1.3 ,因此我在VS中更新了 NETStandard.Library -接受了随附的许可证

      In the main Packages folder, right-clicking NETStandard.Library says version 1.6.0, but typing dotnet --version into Terminal shows 2.1.3, so I update NETStandard.Library in VS – accept the licenses that come up.

      重建后仍然有相同的警告.

      Same warning still in place after rebuilding.

      因此,我转到警告提供的Microsoft链接,并按照其指令,将<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>添加到各种.csproj文件中.

      So I go to the Microsoft link provided by the warning and follow their instructions to add <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> to the various .csproj files.

      我将此添加到了.csproj主文件中,重建了项目并得到了相同的警告.

      I added this to the main .csproj file, rebuilt the project and got the same warning.

      我将此添加到了iOS和Android .csproj文件中,重建了项目并得到了相同的警告.

      I added this to both the iOS and Android .csproj files, rebuilt the project and got the same warning.

      那么这是什么问题,为什么它这么持久,如果我不理会它,将会给我带来多大的麻烦呢?

      So what's this problem, why is it so persistent, and how much trouble will it give me down the road if I just ignore it?

      推荐答案

      最后解决了此警告,解决方案颇具直觉.

      Finally fixed this warning, and the solution was rather counterintuitive.

      尽管警告特别指出,但请在以下位置将" AutoGenerateBindingRedirects属性设置为true 项目文件" ,只有将<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>更改为<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>时,警告才会消失.

      Despite the warning saying specifically "Please set the "AutoGenerateBindingRedirects" property to true in the project file", the warning will only go away if you change <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> to <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>.

      这篇关于如何在Mac的Visual Studio中设置AutoGenerateBindingRedirects?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆