locked
Verify if Visual C++ 2008 SP1 Redistributable Package is Installed RRS feed

  • Question

  • Hello

    Is there a way to know if Visual C++ 2008 SP1 Redistributable Package is installed in the machine using C#.

    Many thanks,
    Paulo

    Friday, September 4, 2009 2:20 PM

Answers

  • Rolling through the items in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and checking the DisplayName value in each of those fields should give you something you can match against to see if it's installed.  This code will display them all, and should help you narrow it down:

    string rootkey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";

    var subkeys = Registry.LocalMachine.OpenSubKey(rootkey).GetSubKeyNames();

    foreach (string subkey in subkeys)

    {

        RegistryKey key = Registry.LocalMachine.OpenSubKey(rootkey + @"\" + subkey);

        string displayname = key.GetValue("DisplayName") as string;

        Console.WriteLine(displayname);

    }


    Coding Light - Illuminated Ideas and Algorithms in Software
    Coding Light WikiLinkedInForumsBrowser
    • Marked as answer by Paulo Azevedo Friday, September 4, 2009 2:32 PM
    • Unmarked as answer by Paulo Azevedo Friday, September 4, 2009 3:11 PM
    • Marked as answer by Paulo Azevedo Friday, September 4, 2009 3:15 PM
    Friday, September 4, 2009 2:28 PM

All replies

  • Rolling through the items in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and checking the DisplayName value in each of those fields should give you something you can match against to see if it's installed.  This code will display them all, and should help you narrow it down:

    string rootkey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";

    var subkeys = Registry.LocalMachine.OpenSubKey(rootkey).GetSubKeyNames();

    foreach (string subkey in subkeys)

    {

        RegistryKey key = Registry.LocalMachine.OpenSubKey(rootkey + @"\" + subkey);

        string displayname = key.GetValue("DisplayName") as string;

        Console.WriteLine(displayname);

    }


    Coding Light - Illuminated Ideas and Algorithms in Software
    Coding Light WikiLinkedInForumsBrowser
    • Marked as answer by Paulo Azevedo Friday, September 4, 2009 2:32 PM
    • Unmarked as answer by Paulo Azevedo Friday, September 4, 2009 3:11 PM
    • Marked as answer by Paulo Azevedo Friday, September 4, 2009 3:15 PM
    Friday, September 4, 2009 2:28 PM
  • It works for the item you're looking for:

    The results I received were this:

    Microsoft Visual C++ 2008 ATL Update kb973924 - x86 9.0.30729.4148
    Visual C++ 2008 x64 Runtime - (v9.0.30729)
    Visual C++ 2008 x64 Runtime - v9.0.30729.01
    Visual C++ 2008 IA64 Runtime - (v9.0.30729)
    Visual C++ 2008 IA64 Runtime - v9.0.30729.01
    Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729
    Microsoft Visual C++ Compilers 2008 Standard Edition - enu - x86
    Visual C++ 2008 x86 Runtime - (v9.0.30729.4148)
    Visual C++ 2008 x86 Runtime - v9.0.30729.4148
    Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17 <--- SP1
    Visual C++ 2008 x86 Runtime - (v9.0.30729)
    Visual C++ 2008 x86 Runtime - v9.0.30729.01
    Coding Light - Illuminated Ideas and Algorithms in Software
    Coding Light WikiLinkedInForumsBrowser
    Friday, September 4, 2009 3:13 PM
  • Seriously?

    What about if the x64 version is installed

    What about if the version Microsoft Visual C++ 2023 Redistributable - x86   is installed

    What about if the version Librairie redistribuée pour Microsoft Visual C++ 2023- x86   is installed

    What about the dll was deleted unregistered or moved?

    Surely the best method would be to call it through COM and check that it works.
    I can't find a sample anywhere though

     

    Friday, December 9, 2011 12:56 PM