Click here to Skip to main content
12,999,580 members (105,019 online)
Rate this:
Please Sign up or sign in to vote.

I have a web setup project. I need to check whether IIS is configured on target machine before installation. I have used the following URL, IIS Launch Condition[^] , But this is not working if the target machine is Windows 7 . Can anyone help me to solve this?

Update : This issue is with 64 bit OS only.

Now I can check the presence of IIS by reading registry key. Here is the code for that.

private bool showError = false;
public bool ShowError
    get { return showError; }
    set { showError = value; }
private string subKey = @"SOFTWARE\Wow6432Node\Microsoft\Inetmgr\Parameters";
public string SubKey
     get { return subKey; }
     set { subKey = value; }
private RegistryKey baseRegistryKey = Registry.LocalMachine;
public RegistryKey BaseRegistryKey
            get { return baseRegistryKey; }
            set { baseRegistryKey = value; }

private void ShowErrorMessage(Exception e, string Title)
    if (showError == true)
      MessageBox.Show(e.Message,Title,MessageBoxButtons.OK, MessageBoxIcon.Error);

        public string Read(string KeyName)
            RegistryKey rk = baseRegistryKey;
            // Open a subKey as read only
            RegistryKey sk1 = rk.OpenSubKey(subKey);
            // If the RegistrySubKey doesn't exist -> (null)
            if (sk1 == null)
                return null;
                    // If the RegistryKey exists I get its value or null is returned.
                    return (string)sk1.GetValue(KeyName.ToUpper()).ToString();
                catch (Exception e)
                    ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper());
                    return null;
     private void button2_Click(object sender, EventArgs e)

But in my web setup project, the Launch condition is not working.
I have tried it as follows....
Name    = Search for IIS
regKey  = HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Inetmgr\Parameters
Root    = vsdrrHKLM
Value   = MajorVersion

I have given the condition as follows....


But this condition is not seems to be working. When I tried it in a 64 bit Windows 7 machine with IIS configured, the installer failed with IIS launch condition.

Any help on this would be appreciated.

Posted 26-Jun-12 0:13am
Updated 29-Jun-12 2:33am
Sebastian T Xavier 2-Jul-12 2:11am
This issue is not yet solved; If anyone knows the solution please update, thanks

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Does this not help: Right-click web setup project -> View -> Launch Condition -> IIS Condition to set for IIS check.

There is an alternative that can be used. We are told that which registry key needs to be checked for IIS here:[^].
Your launch condition can read that specific registry key (HKLM\SOFTWARE\Microsoft\InetStp\Components\Metabase) and check if the value equals the string "1".

This post[^] sounds user was successful in it with Win7.

Worth a try!
Sebastian T Xavier 27-Jun-12 1:07am
Thank you Sandeep. This is what I have tried earlier. This is working fine in windows xp but in Windows 7, it's not working as expected. I hope you have seen the URL in my post.
Sandeep Mewara 27-Jun-12 2:04am
Ok. I did looked at your link but to me it looked a little different setting/way to have IIS check.

Will share if I come across anything else.
Sebastian T Xavier 27-Jun-12 2:13am
Thank you Sandeep
Sandeep Mewara 27-Jun-12 2:58am
Updated my answer with an alternative that I came across.
Sebastian T Xavier 28-Jun-12 6:44am
Thanks Sandeep, for your update. At last I have figured out the exact problem. The above registry key read will not work with 64 Bit OS. I have confirmed this with a 32 bit Windows 7 OS.
Sandeep Mewara 28-Jun-12 6:56am
If that is the case which does sounds very valid one, check if the registry value expected is in Wow64 hierarchy (for 64 bit apps thats the place) in registry.
Sebastian T Xavier 29-Jun-12 1:33am
Sandeep, I have tried it but not succeeded. Please find the updated question. Once again thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 29 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100