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;
RegistryKey sk1 = rk.OpenSubKey(subKey);
if (sk1 == null)
{
return null;
}
else
{
try
{
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