Can't register RAPI2.dll RRS feed

  • Question

  • Hello,

    I am trying to register the RAPI2.dll in VS2008 project.

    First thing I did was download the RAPI2.dll from CodePlex. Then I put the dll in the system32 folder then I open the command prompt and typed in REGSERV32 RAPI2.dll

    hit enter.

    then went to the VS2008 project and referenced the dll by browsing to the dll in the system32 folder. that added the RAPI2.dll to the reference folder in the VS2008 project.

     I then ran the project and immediatly got this error:

    "Could not load type system.devices.remotedevicemanager from assembly Rapi2, version=, culture=neutral, PublicKeyToken=null"

    when I looked this up on the net I got that I should not use regser32 but I should use Regasm.

    So I opened the Visual Studio 2008 command Prompt and typed in 'regasm rapi2.dll /tlb:rapi2.tlb'

    got back the message "the type library ws registered successfully"

    then the internet said to type in "regasm /tlb:rapi2.tlb rapi2.dll"

    Which I did then hit enter. I got back this message "Assembly exported to C:\Windows\system32\rapi2.tlb, and the type library was registered successfully"

    When I look in the system32 folder there is a RAPI2.dll and a RAPI2.tlb

    I then opened VSD2008 project. Went to the reference folder and added a new reference. I went to the COM tab and found RAPI2 in the list. But when I clicked on it and then clicked OK I get this message:

    A reference to RAPI2 could not be loaded. the ActiveX type library C:\WINDOWS\system32\rapi2.tlb was exported from a .NET assembly and connot be added as a reference. Add a refence to the .NET assembly instead.

    But when I try to add the reference through the .NET tab there is no RAPI2 in the list. When I browse to the dll by the Browse tab I am able to register the dll and the RAPI.dll shows in the Reference list in the project. But when I try to run the app I get the original error

    "Could not load type system.devices.remotedevicemanager from assembly Rapi2, version=, culture=neutral, PublicKeyToken=null"

    Please help. What am I doing wrong???
    Thank You

    P.S. One thing I did notice is that in the error message it says the the RAPI2 is version= but in the Add Reference window under the COM tab it says that the RAPI2 in the system32 folder is version 1.3.

    Monday, July 25, 2011 6:35 PM


  • Hello,


    Did you download the Remote API 2 (RAPI2) Managed Wrapper in codeplex? As far as I know, it is a library for .NET.


    If you want to use RAPI2 in .NET Framework, you can create a .NET Framework project and include it.


    If you want to use RAPI2 in C++, you cannot include that library. You need call RAPI2 in COM.

    First, please download and install the Windows Mobile SDK:

    Windows Mobile 6 Professional and Standard Software Development Kits Refresh

    Then, you can follow the sample codes in that SDK to use RAPI2. The sample is in this folder:

    Windows Mobile 6 SDK\Samples\Common\CPP\Win32\Rapi


    I hope my suggestions can help you to solve this problem.


    Best regards,



    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Friday, July 29, 2011 7:17 AM
    • Marked as answer by Jesse Jiang Tuesday, August 2, 2011 7:04 AM
    Wednesday, July 27, 2011 7:31 AM