无法加载文件或程序集Bond.IO [英] Could not load file or assembly Bond.IO

查看:82
本文介绍了无法加载文件或程序集Bond.IO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Microsoft.Bing.Speech nuget包和Net Framework 4.6.1 调用RecognizeAsync()

Using Microsoft.Bing.Speech nuget package and Net Framework 4.6.1 I'm having this exception when calling RecognizeAsync()

无法加载文件或程序集'Bond.IO,Version = 1.0.0.0, 文化=中性,PublicKeyToken = 31bf3856ad364e35'或其中之一 依赖关系.找到的程序集的清单定义不 匹配程序集参考. (来自HRESULT的异常:0x80131040)

Could not load file or assembly 'Bond.IO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我的代码:

public static async Task SpeechToTextStreamPO(Stream audioStream, string textResult)
    {
        var subscriptionKey = ConfigurationManager.AppSettings["BingSpeechSubscriptionKey"];

        Uri ShortPhraseUrl = new Uri(@"wss://speech.platform.bing.com/api/service/recognition");
        Uri LongDictationUrl = new Uri(@"wss://speech.platform.bing.com/api/service/recognition/continuous");
        CancellationTokenSource cts = new CancellationTokenSource();

        var preferences = new Microsoft.Bing.Speech.Preferences("en-IN", ShortPhraseUrl, new CognitiveServicesAuthorizationProvider(subscriptionKey));

        // Create a a speech client
        using (var speechClient = new SpeechClient(preferences))
        {
            speechClient.SubscribeToRecognitionResult(async (recognitionResult) =>
            {
                if (recognitionResult.RecognitionStatus == Microsoft.Bing.Speech.RecognitionStatus.Success)
                {
                    textResult = recognitionResult.Phrases[0].DisplayText;
                }
            });

            var deviceMetadata = new DeviceMetadata(DeviceType.Near, DeviceFamily.Mobile, NetworkType.CellLTE, OsName.Android, "1607", "Dell", "T3600");
            var applicationMetadata = new ApplicationMetadata("SampleApp", "1.0.0");
            var requestMetadata = new RequestMetadata(Guid.NewGuid(), deviceMetadata, applicationMetadata, "SampleAppService");

            await speechClient.RecognizeAsync(new SpeechInput(audioStream, requestMetadata), cts.Token).ConfigureAwait(false);}
    }

我尝试在.csproj中安装不同的版本并更改版本号,但是我无法使其正常工作.

I've tried installing different versions and changing version numbers in .csproj but I can't make it work.

有什么想法吗?

推荐答案

它通过将Bond.Core.CSharp包更改为4.2.0为我工作.

it worked for me with changing Bond.Core.CSharp package to 4.2.0

这篇关于无法加载文件或程序集Bond.IO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆