Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello,
 
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;
            }
            else
            {
                try
                {
                    // 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)
        {
           MessageBox.Show(Read(@"MajorVersion"));
        }
 
But in my web setup project, the Launch condition is not working.
I have tried it as follows....
Name    = Search for IIS
Propery = IISVERSION
regKey  = HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Inetmgr\Parameters
Root    = vsdrrHKLM
Value   = MajorVersion
 
I have given the condition as follows....
 
IISVERSION >= "#4"
 
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.
 
Regards
Sebastian
Posted 26-Jun-12 0:13am
Edited 29-Jun-12 2:33am
v5
Comments
Sebastian T Xavier at 2-Jul-12 2:11am
   
This issue is not yet solved; If anyone knows the solution please update, thanks

1 solution

Rate this: bad
good
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.
 

UPDATE:
There is an alternative that can be used. We are told that which registry key needs to be checked for IIS here: http://learn.iis.net/page.aspx/135/discover-installed-components/[^].
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!
  Permalink  
v2
Comments
Sebastian T Xavier at 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 at 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 at 27-Jun-12 2:13am
   
Thank you Sandeep
Sandeep Mewara at 27-Jun-12 2:58am
   
Updated my answer with an alternative that I came across.
Sebastian T Xavier at 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 at 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 at 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
0 Sergey Alexandrovich Kryukov 6,725
1 OriginalGriff 6,696
2 CPallini 5,315
3 George Jonsson 3,589
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 29 Jun 2012
Copyright © CodeProject, 1999-2014
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