Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在发布模式下构建我的应用程序_C#_Xamarin_Xamarin.android_Zxing - Fatal编程技术网

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

C# 无法在发布模式下构建我的应用程序,c#,xamarin,xamarin.android,zxing,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_Auto

我的应用程序在调试模式下运行良好,但如果我想在发行版中构建它,则会出现以下错误:

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
Fehler 1将Fehler从链接组件中取出。
Java.Interop.Tools.Diagnostics.XamarinAndroidException:error XA2006:无法解析对“System.Void Xamarin.Forms.Element::set_AutomationId(System.String)”的引用(在程序集“ZXing.Net.Mobile.Forms,Version=2.1.47.0,Culture=neutral,PublicKeyToken=null”中定义,作用域为“Xamarin.Forms.Core,Version=2.0.0.0.0,Culture=neutral,PublicKeyToken=null'。当作用域与定义程序集不同时,通常意味着类型被转发。-->Mono.Cecil.ResolutionException:未能解析System.Void Xamarin.Forms.Element::set_AutomationId(System.String)
bei Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference)
bei Mono.Linker.Steps.MarkStep.MarkInstruction(指令指令)
bei Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
bei Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition方法)
bei Mono.Linker.Steps.MarkStep.ProcessQueue()
bei Mono.Linker.Steps.MarkStep.Process()
bei Mono.Linker.Steps.MarkStep.Process(LinkContext)
bei MonoDroid.Tuner.MonoDroid markstep.Process(链接上下文)
bei Mono.Linker.Pipeline.Process(链接上下文)
bei MonoDroid.Tuner.Linker.Process(LinkerOptions选项、LinkContext和context)
bei Xamarin.Android.Tasks.LinkAssembly.Execute(DirectorySassemblyResolver)
---我们的国际关系---
bei Java.Interop.Tools.Diagnostics.Diagnostics.Error(Int32代码,异常innerException,字符串消息,对象[]args)
bei Xamarin.Android.Tasks.LinkAssembly.Execute(DirectorySassemblyResolver)
bei Xamarin.Android.Tasks.LinkAssemblies.Execute()
bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute()
bei Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()Euroscola_App1
这个问题从今天起就存在了,我不知道原因是我下载了一个更新的Xamarin版本,还是因为我安装了ZXing软件包

当作用域与定义程序集不同时,通常意味着类型被转发

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

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

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

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


如果删除ZXing,问题是否仍然存在?我遇到了类似的问题,有问题的库是
Rg.Plugins.Popup
,有问题的库(无法解决)是
System.Collections.Generic.Queue
。我尝试在
Rg.Plugins.Popup上跳过链接,但仍然出现相同的错误。有什么建议吗?@G_Money这是你问题的答案