This project is read-only.


  • Download the source.
  • Install the COM interop Assemblies via the installer installer OR
  • Create the interop object on your machine
    • Open the downloaded solution.
    • Open the "ComPort" project's properties and check "Register for COM interop" in the build-tab.
    • Build (needs elevated rights the first time for COM-registration -- so I did not check in, with the "Register for COM interop" checked). If you get an error about not being able to register the SerialPort.dll you may have forgotten to open the solution as administrator.
  • Open and build the SLSerialPort project.
  • Create a new Silverlight app to consume the COM object.
    • Open the properties of the new project
      • In the "Silverlight" tab check "Enable running application out of the browser"
      • Open "Out-of-Browser Settings ..."
      • Near the bottom of the new dialog check "Require elevated trust when running outside of the browser"
    • Add a reference to SLSerialPort project or resulting assembly.
    • Reference the serial port as in native .NET:
using System.IO.Ports;
namespace SerialPortEnabledApp {
   class SerialPortConnector {
        SerialPort port = new SerialPort("COM1");

Last edited Jul 29, 2011 at 1:12 PM by gotthelastid, version 19


tusharmaru Jun 13, 2011 at 2:09 PM 
Hi have tried this but when I read the data from the com port port.readExisting() then it gave me the folowing out when I see in the debug Plesae help me out on this problem. Why getting this type of string from the GPS - "?\0x??x?x?x\0x?`x??x??x??\0x?x?`x?x?x?x?x?x?x?x?x?xxf~x?x??`x`\0?~??f??x?x?xx??x??xx?xxx???x?x?\0x??\0xx?x??\0xx??\0xx??xx?x?x??fxx?\0x??\0x?x??xx??~xx????`x`\0?????xx\0xxx?\0xxx??xx\0x?x?xxxx??????\0xxxx?`xxx?x?f?\0x?x?x?xx?x?\0x?x?xx\0xx?x?????`fxx???`x`\0?~?`?xx\0xx?x?\0xxx?xx\0x?x?xxxx??????\0xxxx?`xxxx?f?x?\0x?x?~x?x?xx??x???????fx???x?????x??x?\0xxxxfxxx????`x`\0?~???\0??x?\0xx?\0x??x?x?xx?x?????????????????x?`x?~x?x?`x?xfx???`x`\0?????xx\0xx?x?\0xxx??xx\0x?x?xxxx??????\0xxxx?`xxxx?f?\0x?`x?x??x?x??x??xx\0xx?x?????`ffx?x??"

gotthelastid Mar 4, 2011 at 1:34 PM 
Hi nor,
I designed the library so that the communication with serial port is the same as in the available .NET libs for WPF.
You might consider having a read at the documentation

Good luck,

isey8690 Mar 4, 2011 at 10:26 AM 
Hi Paul,

Thanks for your feedback, I'll try it first as what u have suggested. Maybe will take some time since I'm a newbie in SLight :).

Best regards,


gotthelastid Mar 4, 2011 at 8:42 AM 
Hi isey8690,
The most important thing is described on this actual page. Follow all steps from step 4 (Create an new Silverlight app).
You have two possibilities. Either you download the source of the library and compile it by yourself or you can download the binaries. Either way you have to reference the library in your new app (right-click on references and select "Add Reference" and browse to the .DLL). After you have done so you can work with the com-ports the same way you can with an WPF-Application.

isey8690 Mar 3, 2011 at 7:56 AM 
Hi there,

I'm new to Silverlight, but I need to find a way to make Silverlight to talk to COM port. I found your entry very useful to me, and could you please give some sample program on how to run and use your SLSerialPort dll.

Thanks a lot in advance.


gotthelastid Nov 17, 2010 at 3:58 PM 
Hi Hendrik.
First of all, thank you for the feedback.
The interop-stuff only works on windows and only in out-of-browser context (with elevated rights). If you try to access the SerialPort stuff from an app running inside the browser you will get an error because it is not allowed by the sandbox.

messer0815 Sep 28, 2010 at 11:02 AM 

thank u so much for your work! I used your SLSerialPort assembly in my SL4 test application and it works well.
One question remains to me, I am relatively new to SL:

I know that SL is running like in a sandbox, that means, its not possible(or with difficult) to access system resources from this area. Am i right, that because of this we have to enable "running application out of the browser"?
Do you know, wheter it is possible to run the SL app inside the browser or is it only runnable in a "out of browser" mode?

thy again, and greetz, Hendrik