无法在发布模式下构建我的应用程序

时间:2017-03-05 16:55:30

标签: c# xamarin xamarin.android zxing

我的应用程序在调试模式下工作正常,但如果我想在发布中构建它,我会收到以下错误:

Fehler  1   Unerwarteter Fehler bei der LinkAssemblies-Aufgabe.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Xamarin.Forms.Element::set_AutomationId(System.String)' (defined in assembly 'ZXing.Net.Mobile.Forms, Version=2.1.47.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Xamarin.Forms.Element::set_AutomationId(System.String)
   bei Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   bei Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   bei Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   bei Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   bei Mono.Linker.Steps.MarkStep.ProcessQueue()
   bei Mono.Linker.Steps.MarkStep.Process()
   bei Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   bei MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   bei Mono.Linker.Pipeline.Process(LinkContext context)
   bei MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   bei Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   bei Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   bei Xamarin.Android.Tasks.LinkAssemblies.Execute()
   bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()    Euroscola_App1

这个问题从今天开始存在,我不知道原因是我下载了更新的Xamarin版本,还是因为我安装了ZXing软件包。

1 个答案:

答案 0 :(得分:0)

  

当范围与定义程序集不同时,通常意味着转发类型。

您已在Xamarin.Android应用项目中启用了应用链接器,并且Xamarin.FormsZXing.Net.Mobile.Forms中的转发类型之间的版本不匹配。基本上ZXing.Net.Mobile.Forms是针对旧版本的Forms编译的,然后您当前正在项目中使用,如果程序集包含C#扩展,这是一个非常常见的问题。

两个选项,禁用整个应用程序的链接或仅禁用Zing程序集的链接:

要仅针对该一个程序集禁用链接,请编辑您的Android应用程序项目(.csproj)并添加以下< AndroidLinkSkip>

<PropertyGroup>
    <AndroidLinkSkip>ZXing.Net.Mobile.Forms</AndroidLinkSkip>
</PropertyGroup>

参考:Xamarin Android链接:AndroidLinkSkip

相关问题