Geeks With Blogs
Andy Johns' Blog Andy's twisted brain....

I was trying to use a registry condition in a VS.NET setup project today and having a damn hard time with it. The docs seemed simple enough, the registry value I was looking for was there, yet the setup MSI kept telling me the value didn't match.... After much puzzling, and a hint from a co-worker I found the solution....

The trick was the "value" is not as the help indicates, ie the data. The value is the Name of the key as indicated in the right pane of the RegEdit tool. The comparison is simple, "value" exists and has non-blank data, or it doesn't.

 
For example, my search of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSMQ\DisplayName
Becomes:
RegKey: SYSTEM\CurrentControlSet\Services\MSMQ
Root: vsdrrHKLM
Value: DisplayName
 
If the RegKey path exists, and the DisplayName "value" exists and the data of the DisplayName is not blank then the condition passes.
 
Ugh, the docs are clearly wrong. For the Value property they state:

The Value property takes a string that matches the value as displayed in the Data column of the Windows Registry Editor.

And the docs for the RegKey property state:

The RegKey property takes a string that includes the full path to the registry key. For example, if you want to search for the Start Page key for Internet Explorer, the RegKey property should be set to Software\Microsoft\Internet Explorer\Main\Start Page.

Actually the Value is the final part of the key: in the docs example that would be "Start Page"

Ugh, the docs are clearly wrong. For the Value property they state:
Correcting the example in the online docs, the properties should be:
RegKey: Software\Microsoft\Internet Explorer\Main
Root: vsdrrHKCU
Value: Start Page
 
Detecting the actual value of Start Page does not seem possible....
-Andy
Posted on Wednesday, September 29, 2004 10:54 PM | Back to top


Comments on this post: Using Registry conditions in VS.NET Installer projects

# re: Registry Entries
Requesting Gravatar...
How can i set the following registry entries while working on setup project?so that when Installer runs,it overwrites entries with my entries:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar] "{<your deskband guid>}"="<Your app name>"

IE will also need for some additional info such as menu and help text, so you need to create these as well:

[HKEY_CLASSES_ROOT\CLSID\{<your guid>}]
"MenuText"="<what you wish to be displayed in IE Toolbars menu" "HelpText"="Show/hide <your app>"


thanks

-adnan
Left by Adnan Siddiqi on Nov 25, 2004 10:22 PM

# Using Registry conditions in VS.NET Installer projects
Requesting Gravatar...
I wish I had found this before I spent several hours trying to figure it out.
http://geekswithblogs.net/ajohns/archive/2004/09/29/11936.asp...
Left by aspZone.com on Aug 30, 2005 6:44 AM

# re: Using Registry conditions in VS.NET Installer projects
Requesting Gravatar...

Hi Andy,

Thanks for your comments. It has helped me solved my problem.


Thanks.
Left by khong from Sulzer Chemtech on Sep 20, 2005 2:55 AM

# re: Using Registry conditions in VS.NET Installer projects
Requesting Gravatar...
Many thanks for posting this, this launch conditions problem has been foxing me all day.
Left by Nigel on Jan 26, 2010 5:39 AM

# re: Using Registry conditions in VS.NET Installer projects
Requesting Gravatar...
Hi Andy,
thank you so much for this post. I think I searched whole msdn and google pages and got crazy while eating my keyboard. How could they write such wrong docs? I can't believe.

How can we vote for you, so your site will get the first result on google? :)
Left by ibram on Jun 11, 2010 6:20 AM

# re: Using Registry conditions in VS.NET Installer projects
Requesting Gravatar...
How to write a condition where the Value should be specific string(i.e. string in data column). for example : DisplayName="MyTestProgram".
Left by Srinivas on Oct 18, 2017 8:53 AM

Your comment:
 (will show your gravatar)


Copyright © Andy Johns | Powered by: GeeksWithBlogs.net