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?
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>
.<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
My experience was that we need
<AutoGenerateBindingRedirects>
to betrue
.My Dev Environment:
#Solution:
What I did is followed the instructions as given in following MS Doc(link).
MyBeautifulApp.Xamarin.iOS.csproj
from the Visual Studio Xamarin Forms solution.MyBeautifulApp.Xamarin.iOS.csproj
file manually using TextEdit and add the following line<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
to the PropertyGroup which is related to your Build Config which you were trying to build and was giving the error.
.csproj
file. Then close the file and reload the Project in your VS Solution Explorer.Note: I edited the
.csproj
file of my Xamarin.Forms iOS App project only. Because Android project which was within the Xamarin.Forms solution were already built successfully.After editing my
MyBeautifulApp.Xamarin.iOS.csproj
file manually it looked like following:Further More: The question now I have is should I do this change for all the other PropertyGroups of that .iOS.csproj file which are related to other Build configurations? I would be glad to know from someone out there. But for now I have decided not to touch those until it gives me a warning/error in the future.
Hope this will be helpful to anybody out there.