更新后Xamarin Android链接器错误

时间:2018-03-30 19:10:21

标签: android xamarin xamarin.android mono

我有几个Xamarin Android项目已经很好地工作了很长时间。我刚刚将最新的Xamarin Nuget软件包升级到版本27.0.2。我安装了Android SDK Platform 27,Android SDK Tools 26.1.1,Android SDK Platform Tools 27.0.1和SDK Build Tools 27.0.3。由于我这样做,我的所有项目都在发布模式下编译,除了1.它收到以下错误:

Severity    Code    Description Project File    Line    Suppression State
Error       The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Configuration.ConfigurationException' (defined in assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') with scope 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Configuration.ConfigurationException
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() MPS Mobile Driver.Droid         

我在代码中找不到任何对System.Configuration的引用。我看过参考文献。我做了全球搜索。我甚至用记事本打开了项目文件并查看了那里。 jsut似乎不是对System.Configuration的引用。

如果我将链接设置为None,它将编译。奇怪的是我在Debug配置中将Linking设置为SDK Assemblies并且编译得很好。我真的需要能够在发布模式下使用Linking设置为SDK Assemblies来编译它,或者应用程序非常大。有人可以帮忙吗?

谢谢, 吉姆

1 个答案:

答案 0 :(得分:0)

我在我的应用程序中引用了System.Data。我认为它是由我试图用于图形处理的Nuget包放在那里的。无论如何,一旦我删除了该引用,它编译得很好。