Search code examples
c#vonage

Sending SMS using Nexmo.Csharp.Client


After running my code as I have seen in the documentation

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);

And this is the error says

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.'


Solution

  • A couple of things that might help here. In the docs, check the "Install your dependencies" section and check that the Nexmo client has installed OK.

    I'd also recommend taking a look at the full script and making sure you have the imports etc - that error message could indicate a missing dependency. Here's the link to the runnable code that the docs page uses: