Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/257.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.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# &引用;Can';t解析引用“;在Xamarin.iOS中使用Azure服务总线包时_C#_Azure_Xamarin.ios_Linker_Servicebus - Fatal编程技术网

C# &引用;Can';t解析引用“;在Xamarin.iOS中使用Azure服务总线包时

C# &引用;Can';t解析引用“;在Xamarin.iOS中使用Azure服务总线包时,c#,azure,xamarin.ios,linker,servicebus,C#,Azure,Xamarin.ios,Linker,Servicebus,我正在我的Xamarin.iOS项目中使用。当链接处于关闭状态时,这对调试生成工作正常,但当我想要发布发布生成(默认设置为“仅链接框架SDK”)时,它会失败,并出现以下错误: /Users/Gerwin/Public/Projects/Sandbox/Test3/MTOUCH:错误MT2101:无法解析引用'System.Threading.Tasks.Task`1 Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationCon

我正在我的Xamarin.iOS项目中使用。当链接处于关闭状态时,这对调试生成工作正常,但当我想要发布发布生成(默认设置为“仅链接框架SDK”)时,它会失败,并出现以下错误:

/Users/Gerwin/Public/Projects/Sandbox/Test3/MTOUCH:错误MT2101:无法解析引用'System.Threading.Tasks.Task`1 Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions::AcquireTokenAsync'(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext,System.String,System.String,Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential)”,从方法“System.Void Microsoft.Azure.Services.AppAuthentication.AdalAuthenticationContext/d__0::MoveNext()引用)'在'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform,Version=3.14.2.11,Culture=neutral,PublicKeyToken=31bf3856ad364e35'(MT2101)(Test3)

配置:

  • macOS 10.15.1
  • Visual Studio for Mac 8.3.8(构建8)
  • Xamarin.iOS 13.6.0.12
  • .NET核心SDK 3.0.100
复制步骤:

  • 通过向导创建新的iOS应用程序

  • 添加NuGet软件包Microsoft.Azure.ServiceBus(最新版本,4.1.1)

  • 添加一些代码以调用API,例如在
    AppDelegate.cs
    中的
    FinishedLaunching
    方法中:

    InvokeOnMainThread(async () => {
        var client = new TopicClient("", "", RetryPolicy.NoRetry);
        var message = new Message(new byte[0]);
        await client.SendAsync(message);
        await client.CloseAsync();
    });
    
(您还需要使用Microsoft.Azure.ServiceBus;的

  • 现在,模拟器的调试构建工作正常
  • 但是,iOS设备的版本生成会产生上述错误
显示了一个稍有不同但相关的错误:

MTOUCH:错误MT2101:无法解析从方法“System.Void Microsoft.Azure.Services.AppAuthentication.ClientCertificateAzureServiceTokenProvider/d__8::MoveNext()引用的引用“Microsoft.IdentityModel.Client.ActiveDirectory.ClientAssertionCertificate”'在'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform,Version=3.14.2.11,Culture=neutral,PublicKeyToken=31bf3856ad364e35'中'


单独添加NuGet软件包Microsoft.IdentityModel.Clients.ActiveDirectory没有帮助;禁用链接会起作用,但会生成更大的.IPA文件。(这在我的实际应用程序中是一个问题,它使用了更多的库。)我尝试使用该选项,例如使用
--linkskip=Microsoft.IdentityModel.Clients.ActiveDirectory
没有帮助。我最终使用的是旧版本(2.0.0)ServiceBus软件包的版本。

同样存在此问题,将软件包降级到V2.0.0解决了问题。或者将链接器选项设置为“不链接”,但这会使IPA的大小显著增大。是的,我最终也将软件包降级。很抱歉,没有发布此消息。。。