我目前正在开发一个名为ABCD的Xamarin.Forms项目,使用macOS Sierra v10.12.6和Visual Studio(VS)for Mac v7.3.2(设置步骤详细介绍here)。
成功完成后,我继续如下:
警告MSB3276:发现同一依赖程序集的不同版本之间存在冲突。请在项目文件中将“AutoGenerateBindingRedirects”属性设置为true。有关更多信息,请参阅http://go.microsoft.com/fwlink/?LinkId=294190。 (MSB3276)(ABCD.iOS)
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
添加到各种.csproj文件中。那么这个问题究竟是什么呢,它为什么如此执着,如果我忽视它会给我带来多大的麻烦呢?
最后修正了这个警告,解决方案相当违反直觉。
尽管有警告说“请在项目文件中将”AutoGenerateBindingRedirects“属性设置为true”,但只有将<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
更改为<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
时警告才会消失。
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
我的经验是,我们需要<AutoGenerateBindingRedirects>
成为true
。
我的开发环境:
#解:
我所做的是遵循以下MS Doc(link)中给出的说明。
MyBeautifulApp.Xamarin.iOS.csproj
。MyBeautifulApp.Xamarin.iOS.csproj
文件,并添加以下行<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
到您正在尝试构建并正在提供错误的Build Config相关的PropertyGroup。.csproj
文件。然后关闭该文件并在VS Solution Explorer中重新加载Project。注意:我只编辑了我的Xamarin.Forms iOS App项目的.csproj
文件。因为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...
更多:我现在的问题是,我应该对该.iOS.csproj文件中与其他Build配置相关的所有其他PropertyGroup进行此更改吗?我很高兴知道那里有人。但是现在我决定不再触摸那些,直到它在将来给我一个警告/错误。
希望这对任何人都有帮助。