locked
WIndows Installer SDK - Visual C++ or C# RRS feed

  • Question

  • Hello *.*,
    I want to know that, in which programming language one can use the  MS-Windows Installer SDK. Is there full-support for MSI-SDK in C#?

    Can anyone name me the SDK Documentation resources?

    Thanks for reply.
    Abdus Salam
    Monday, February 1, 2010 1:01 PM

Answers

  • Hi Abdus,

    Thank you for your prompt reply!

    All Windows Installer API functions are written in C++ and Windows Installer SDK doesn't offer functions in C#. So if you would like to call the Windows Installer API functions from a C# application, you must use P/Invoke to call these unmanaged functions.

    As for reading installer database, there're a set of functions to do it, e.g. MsiOpenDatabase, MsiDatabaseOpenView, etc. All MSDN documents about installer database functions are under the Windows Installer Reference | Installer DataBase node:
    http://msdn.microsoft.com/en-us/library/aa369395(VS.85).aspx

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, February 3, 2010 9:44 AM

All replies

  • http://wix.sourceforge.net/

    This is probably the best path to follow. But fyi Windows Installer is neither C++ nor C#. It is actually a fully relational database that msiexec reads and goes through the tables doing things one at a time.
    If you want things like custom actions then you are most likely stuck using C++ though.
    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    Monday, February 1, 2010 6:28 PM
  • Hi Abdus,

    Windows Installer functions are mainly for C++. To use unmanaged functions from managed code, we can make use of Platform Invoke. For more information on Platform Invoke, please read the following MSDN document:
    http://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx

    For Windows Installer functions reference, please visit the following link:
    http://msdn.microsoft.com/en-us/library/aa369425(VS.85).aspx

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu

    MSDN Subscriber Support in Forum 
    If you have any feedback on our support, please contact msdnmg@microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Edited by Linda Liu Wednesday, February 3, 2010 9:15 AM
    Tuesday, February 2, 2010 7:35 AM
  • Hello *.*,

    Thanks for replying.

    Actually I want to read a msi file. As said, its a relational db, then I want to know is MS Windows Installer SDK offers the functions completly direct in C#.

    But I think as the Ms.  Liu reponded, one can call the unmanged code through mangede code. It means I can use C# to call the native functions. But mainly main functions are written in C++. Is this interpretation correct?

    Where can I find the MSI SDK Documentation?

    Thanks
    Abdus Salam
    Tuesday, February 2, 2010 9:11 AM
  • The second link that was given by Linda above was to the Windows Installer SDK function reference, so if you did follow that link then you would notice that it is an item under Windows Installer, and that is the Windows Installer SDK documentation.

    If you want a downloadable version then it is part of the Windows SDK (it is under the same node) and it is also part of the MSDN (again, under the same node). So I would guess you already have it but haven't noticed.
    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    Tuesday, February 2, 2010 10:32 AM
  • Hi Abdus,

    Thank you for your prompt reply!

    All Windows Installer API functions are written in C++ and Windows Installer SDK doesn't offer functions in C#. So if you would like to call the Windows Installer API functions from a C# application, you must use P/Invoke to call these unmanaged functions.

    As for reading installer database, there're a set of functions to do it, e.g. MsiOpenDatabase, MsiDatabaseOpenView, etc. All MSDN documents about installer database functions are under the Windows Installer Reference | Installer DataBase node:
    http://msdn.microsoft.com/en-us/library/aa369395(VS.85).aspx

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, February 3, 2010 9:44 AM
  • Hi Abdus,

    How about the problem now?
    If you need help, please feel free to let me know.

    Sincerely,
    Linda Liu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, February 9, 2010 5:48 AM
  • Isn't it a strange MS policy?

    Windows Installer is one of the main deployment options for .NET applications, but there's no API wrapper for .NET provided by MS. So everyone should reinvent the weel.

    It's pity namespace System.Deployment.Application contains api only for ClickOnce
    Tuesday, March 2, 2010 11:29 AM