gpt4 book ai didi

azure - 添加对 Azure Blob 存储的 nlog 支持后,Xamarin 版本构建失败

转载 作者:行者123 更新时间:2023-12-03 03:43:57 25 4
gpt4 key购买 nike

将 NLog 添加到我们的 Xamarin 表单应用并支持 Azure Blob 存储后,Android 版本构建失败,并显示以下内容:

Error       Mono.Linker.MarkException: Error processing method: 'System.Void Microsoft.Azure.Services.AppAuthentication.AdalAuthenticationContext/<AcquireTokenAsync>d__3::MoveNext()' in assembly: 'Microsoft.Azure.Services.AppAuthentication.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task`1<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions::AcquireTokenAsync(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext,System.String,System.String,Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
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)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 iliidit.Android

我已将其追溯到包NLog.Extensions.AzureBlobStorage,并看到该包具有Microsoft.Azure.Services.AppAuthentication作为依赖项(这是在错误消息中!)。

我发现:https://stackoverflow.com/a/69050534/11269239这是有点相似,但不同的二进制文件。已尝试设置链接器文件,但似乎无法解决...

阅读本文:https://learn.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker我尝试了很多组合,但认为这是最精确的。

<linker>
<assembly fullname="Microsoft.IdentityModel.Clients.ActiveDirectory">
<type fullname="AuthenticationContextIntegratedAuthExtensions">
<method name="AcquireTokenAsync" />
</type>
</assembly>
</linker>

并将构建操作设置为 LinkDescription。

我也尝试过通配符......不知道我做错了什么:(

最佳答案

新更新的 NLog.Extensions.AzureBlobStorage 版本 4.0 现已发布,它从旧版 AzureServiceTokenProvider 切换到新的 Azure.Identity:

https://www.nuget.org/packages/NLog.Extensions.AzureBlobStorage

希望它能解决 Android 平台上的构建问题

关于azure - 添加对 Azure Blob 存储的 nlog 支持后,Xamarin 版本构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69988578/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com