Compiling PowerSDR with Visual Studio 2008

I decided to have a deeper look into Flexradio’s SDR Software PowerSDR. PowerSDR is published as open source under the GPL license and was written under Visual Studio 2003 against the old .NET 1.1 Framework. Unfortunately, the code was never migrated to a higher Version of Visual Studio. The last couple of days I had enough time to dive deep into the source code and finally make it compilable under Visual Studio 2008. In this post I’ll share the details with you.

[This article has been updated on 7/April/2010]

before you start, read this:

[Update 7. April 2010]

Attention! The information in this article has been superseeded. I was not aware that PowerSDR has already been migrated to Visual Studio 2008. Bob MyGwier, N4HY did a terrific job with the migration. However, the source code is currently not available for download on the Flex-Radio website. You have to download it directly from the SVN. This Version has the codename Pretty Betty and will be released in 2010 as PowerSDR 2.0. The Sourcode of Powersdr – Pretty Betty is located in this branch of the PowerSDR SVN:


Flex Radio provides on it’s webpage a Tortoise SVN Quick Start Guide.

Again – if you want to compile PowerSDR under Visual Studio 2008 I urge you to use the Pretty Betty source code. However I will leave the original post online for legacy reasons.

[/Update 7. April 2010]

The original article

PowerSDR can’t be compiled out of the box in Visual Studio 2008. One the first attempt you will receive a ton of errors. While I could fixed some of them properly, others, especially the cross-threading exceptions between User Interface Forms will need much more effort. I currently can’t approximate the effort, but it would take for sure several days. For the sake of my purpose it was sufficient to disabled the cross-threading exceptions. Please note that this does not solve the problem. Disabling the cross-threading exceptions causes instability of the software! If you do so, please be aware of it.

The way I’m going to describe worked so far on three different PCs using VS2008 under WindowsXP with full administrative privileges. Be adviced that PowerSDR uses libraries and drivers which work very close to the OS kernel. It might be possible, that your PC configuration (hardware or software) cause additional exceptions during the compilation of PowerSDRs sourcecode.


Before we can start with with compiling and debugging of the source code I would like to mention the prerequisites:

  1. Visual Studio 2008: PowerSDR can not be compiled under the free Visual Studio (2008) Express edition. But – you can download a fully functional 90 day trail of Visual Studio 2008 (Professional) from Microsoft. This version will work perfectly.
  2. DirectX Software Development Kit (SDK). You will need a copy of the DirectX SDK on your development PC. The SDK can be downloaded from Microsoft. The SDK Version of February 2010 works well.
  3. Microsoft Data Access Components (MDAC) 2.8. You need an installed copy of this library on your development PC. It can be downloaded here.
  4. PowerSDR Source code. I used version 1.6.3 (SVN 788). On the Flexradios download page it’s called 1.8.0. Honestly I don’t know why. This is the download link to the  Flexradio website.
  5. Add DirectX include and lib folders into Visual Studio 2008. As a lazy alternative you can copy the files dsound.h and dsound.lib into the PowerSDR source folders Portaudio and pa_win_ds.

Step1: Conversion Wizard

Once you have unzipped the source code, open PowerSDR.sln in Visual Studio 2008. The conversion wizard will pop up and assist you in converting the project into VS2008. Accept and click through the steps.

PowerSDR conversion the VS2008

Step2: Review References

Check the project References in the Solution Explorer. In my case I only had to delete and renew the adodb1 reference. However on one of my other development environments I also had to delete and renew  the DirectX references.

PowerSDR in Solution Explorer

I set these references:

  1. adodb1 version 7.0.3300.0
  2. Microsoft.DirectX version 1.0.2902.0
  3. Microsoft.DirectX.DirectInput version 1.0.2902.0

Step 3: Cross-Thread Problems

Now we are actually ready to start the compiler and have a look on the errors and warnings. At this point PowerSDR should start until the spash screen but terminating with this nasty exception pointing out problems with cross threading.

PowerSDR cross thread ErrorAs mentioned earlier, a proper solution of this problem would cause a major rework of the whole source code. Instead we will bypass this problem by disabling all cross threading exceptions in the source code. Again – this will decrease stability of PowerSDR. Don’t use this bypass if you want to release / publish your own Version of PowerSDR.

Disable the Cross-Thread exception in the constructor of console class in console.cs:

Console Constructor

Step 4: Serial Port problems

Now, the compiler throws an IOException as shown below:

IOException in PowerSDR

I wasn’t really sure where this exception originated from so I started a step by step debugging and finally ended up in the method GetAvailCOMPorts() located in setup.cs. This is the method:

GetAvailCOMPorts broken method

The purpose of this function is to identify the available serial ports of your PC. It’s a kind of trial and error way. The for loop tries to open all serial ports from COM1…COM23. On my development PC, two serial ports are registered – COM3 and COM11 (which is curiously labeled as COM11c).

The exception is called while executing sp.Close(). Somehow the internal handle gets “lost” in the .NET method Freehandle(), located in SerialStream.cs.

Instead of debugging this .NET method, I rewrote the GetAvailCOMPorts() method. There better and faster ways to retrieve the available serial ports on a system. This is how the replacement looks like:

Step 5: Parsing Problems

While on two out of three machines, I could compile the source code at this stage another exception was thrown at my main development machine.

PowerSDR compilation error

After a quick debug session I identified the following three methods in setup.cs causing the exception

  1. comboCATPort_SelectedIndexChanged
  2. comboCATPTTPort_SelectedIndexChanged
  3. initCATandPTTprops()

These routines had problems to parse and handle my standard serial over bluetooth link, interestingly numerated as COM11c.

As an example, here is the code of comboCATPort_SelectedIndexChanged():

Visual Studio combocatport routine

This is the content of the objects while debugging: PowerSDR Debugging

The sub-string 11c can not be transformed into an int32. This causes the format exception. I substituted the code with a more robust version:

This code was applied to all of the mentioned three methods.

Step 6: here we go!

By now, all problems should be resolved and the PowerSDR console should appear!

Powersdr compiled with Visual Studio 2008

Let’s hope that Flexradio will release soon the next big version of PowerSDR! As far as I heard, they also migrated already on Visual Studio 2005 / 2008.

Do like this article? Do you have anything to add? Then leave me a comment!

private ArrayList GetAvailCOMPorts()


ArrayList a = new ArrayList();

for (int i = 1; i < 24; i++)


SerialPorts.SerialPort sp = new SerialPorts.SerialPort();

sp.PortName = “COM” + i.ToString();




if (sp.IsOpen)






catch (Exception) { };


return a;


About Tobias (DH1TW)

Self-confessed Starbucks addict. Loves to travel around the globe. Enjoys the technical preparations of Amateur-Radio contests as much as the contests themselves. Engineer by nature. Entrepreneur. For more, follow him @DH1TW


  1. Contrary to your article, well over a year ago, I ported PowerSDR to Visual Studio 2008. The team at Flex took this and ran with it. You have been able to download functional versions of this with skinning, etc. and is known as Pretty Betty from an svn branch for a year. It will soon be released as the official version.

    Bob McGwier

  2. Avinash says:

    Can i use the same with MS Visual Studio 2005 Professional Edition???

    • Hey Avinash, I personally haven’t compiled PowerSDR in VS2005. But I recommend to use the Pretty Betty branch of PowerSDR. This is the Source code which will be published soon as PowerSDR 2.0. Bob, N4HY has ported the PowerSDR from VS2003 to VS2008. The Pretty Betty code compiles here without a single problem.
      Just give it a try in VS2005. Using the Pretty Betty code is better than using the VS2003 (.NET 1.1) Version of PowerSDR.
      You have to download the Pretty Betty Source code from the SVN repository. This Flex-Radio Knowledge-Base article describes how to setup SVN:

      The Pretty Betty Source code is located in:

      Good luck!

  3. BobG says:

    Seems to have disappeared. . .

    Checkout from svn://, revision HEAD, Fully recursive, Externals included
    Can’t connect to host ‘’: A connection attempt failed because the
    connected party did not properly respond after a period of time, or established
    connection failed because connected host has failed to respond.

    • Hi Bob,
      FlexRadio Systems doesn’t grant access anymore to the SVN due to a change in their development philosophy. However you can request a copy of the latest source code from The sourcecode package comes with an instruction how to compile PSDR.
      73 & happy programming!

Speak Your Mind