Search code examples
xamarin.formscsprojvisual-studio-mac

How to Set AutoGenerateBindingRedirects in Visual Studio for Mac?


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:

  • Right-clicking the main project folder, I select Options.

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

  • 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:

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)

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

  • 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.

  • 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.

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

  • 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?


Solution

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

    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>.