【发布时间】:2021-06-25 14:49:48
【问题描述】:
我是 C# 新手,并且使用了一些代码引用。我添加了一些使用 Microsoft.Azure.Devices.Client 的方法,而一些方法使用了 Microsoft.Azure.Devices。现在消息类不明确的引用,我需要两个 using 语句。我现在能做什么?
错误信息是: "'Message' 是 'Microsoft.Azure.Devices.Client.Message' 和 'Microsoft.Azure.Devices.Message' 之间的模糊引用"
代码是:
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Devices.Client;
using Microsoft.Azure.Devices;
using Microsoft.Azure.Devices.Shared;
using Microsoft.Azure.Devices.Provisioning.Client;
using Microsoft.Azure.Devices.Common.Exceptions;
using Microsoft.Azure.Devices.Provisioning.Client.Transport;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
消息类的使用如下所示:
var message = new Message(Encoding.ASCII.GetBytes(messageString));
我尝试使用Client.Message,但它不起作用。我使用 python 并且是 c# 新手,不知道它是如何工作的。
有人可以详细解释一下解决方案吗?
【问题讨论】: