使用 Nexmo.Csharp.Client 发送短信

Sending SMS using Nexmo.Csharp.Client

在 运行 我在文档中看到的代码之后

var creds = new Nexmo.Api.Request.Credentials
        {
            ApiKey = "xxxxxx",
            ApiSecret = "xxxxxxxxx"
        };

        //this var Im getting the error
        var results = SMS.Send(new SMS.SMSRequest
        {
            from = "CLient",
            to = "639xxxxxxx",
            text = "this is a test"
        }, creds);

这是错误说的

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=1.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'

有几件事可能对您有所帮助。在文档中,检查 "Install your dependencies" 部分并检查 Nexmo 客户端是否安装正常。

我还建议您查看完整的脚本并确保您有导入等 - 该错误消息可能表示缺少依赖项。这是文档页面使用的可运行代码的 link: