Thursday, May 01, 2008

Using VisualStudio Express and BTs SDK

I've seen a lot of posts regarding BT's Web21C SDK and using it with VisualStudio Express. Here's a quick "how-to" to get an example running.

Here's a working solution I used to do the following steps (may even work in VisualStudio Pro):

1) Download and install VSExpress Edition 2008 from

2) Download and extract latest .NET SDK (5.2.1 in this example) from

3) Create a new Visual Studio Project (File->New Project...). Make it a Console Application.

4) Right click on "References" and select "Add reference...".

5) Select the Browse tab and browse to where you extracted the BT SDK and drill down to the libraries folder.

6) Select the "BT.Sdk.Core*" and whatever else library you want to use. In this example, I just selected "BT.Sdk.MessagingOneWayCapability" which brings in the code to send an SMS text message.

7) Go to and generate a new certificate and keypair via

8) Copy the pfx file (don't forget your pwd!) into the project. Right click and "Include in project". Make sure it's properties are set to "Copy To Output Directory = Always"

9) Copy in the *.cer files from the directory where you extracted the SDK. They are located under the "certs" directory. Right click and "Include in Project". Also make sure that the properties are set to "Copy to Output Directory = Always"

10) Right click the Project and select "Add->New Item...". Select "Application Configuration and name the file App.config

11) Add the following content, making sure to set certFile and certPassword to YOUR values (see next step). To access "Oaktree/Production", you will also need to top-up your account with credits from the portal. To access "Acorn/Sandbox", you can only send limited messages and do limited things.

<add key="certFile" value="mycert.pfx"/>
<add key="certPassword" value="yourpwd"/>
<add key="serverCertFile" value="btsdkservercert-oaktree.cer"/>
<add key="Web21c_Environment" value="production"/>

<add type="BT.Sdk.Core.Web21cSoapExtension, BT.Sdk.Core"/>

12) Now, open up Program.cs and enter the following for the Main method:

static void Main(string[] args)
BT.Sdk.Messaging.OneWayCapability.MessagingOneWayManager mgr = new BT.Sdk.Messaging.OneWayCapability.MessagingOneWayManager();
mgr.SendMessage("tel:+yourNBRincludingcountrycode", "Testing from VS Express!");

13) There is no step 13 as that is unlucky.

13.5) Expand the References and remove and re-add the BT* references by right clicking and drilling down to the Libraries subdirectory in the location where you installed the Web21CSDK.

14) Run and it should work. If an exception occurs, cd into the Bin/Debug directory and run your .exe from a cmd prompt.