【发布时间】:2020-11-28 02:02:05
【问题描述】:
我是 Xamarin 的新手,从无法归档 APK for MyApplication.Android 项目的存储库中提取了一个项目。如果链接器设置为“无”,它会成功构建,甚至会创建 APK 文件。但是当我尝试在我的设备上安装时,我收到错误“未安装应用程序”
当我将链接器设置为“仅 SDK 程序集”或“SDK 和用户程序集”时,在发布模式下构建时出现以下错误。
无法解析对IAppInformationFinder 的引用,这是在同一解决方案的另一个项目中定义的接口。是的,它已在 .android 项目中被引用。
Error The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'StevensPINApplication.Interfaces.IAppInformationFinder' (defined in assembly 'StevensPINApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'StevensPINApplication, Version=1.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 StevensPINApplication.Interfaces.IAppInformationFinder
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.MarkInterfaceImplementation(TypeDefinition type, InterfaceImplementation iface)
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 MonoDroid.Tuner.MonoDroidMarkStep.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()
这个问题被多次提出并出现不同的错误,我已经尝试了几乎所有在线提出的可能解决方案,但没有奏效。
将目标框架设置为系统上的最新版本。
这太烦人了,在达到实际需求之前,我一开始就被困在构建过程中。
我正在使用 VS2017。只是在这里添加我已经尝试在 VisualStudio 2015 和 2019 上无法加载开始。这与MSBUILD问题有关。
【问题讨论】:
标签: c# xamarin xamarin.forms xamarin.android visual-studio-2017