Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Checking registry in System Search returns # at the start of the value

Created: 13 May 2013 • Updated: 14 May 2013 | 11 comments
This issue has been solved. See solution.

I am using Wise Installation Studio 7.0

I have an install package that has a 'System Search' to check if .Net 3.5 SP1 is installed. Screenshot: http://screencast.com/t/n8pt4MOIF

I have used the recommend method of checking the Values Install and SP in the Key HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 to see if 3.5 and SP1 is installed respectively.

I then use the properties to hide/show a '.Net 3.5 SP1 Download' button during the install process. I have  added conditions on the Button control to hide/show it - basically, if the values from the above searches both = 0, then it is assumed 3.5 SP1 is not installed, and the button is made visible. Screenshot: http://screencast.com/t/xvG3lC3JUgN 

However, it doesnt seem to be working - from all the articles online that i have read, the values should return 1 when checking these registry keys. 

So what i did to check the value of the properties that is returned from the 'System Search' was to create a Text control on the form where the Download button is located, and added the property name in the 'Control Text' field to it to display the value during the install process. Screenshot: http://screencast.com/t/L9PNHaLSreu 

When testing, the value shown in the text box was #1 and not 1 ......why is that? Is that correct behaviour?

Operating Systems:
Discussion Filed Under:

Comments 11 CommentsJump to latest comment

JohanH's picture

I'm not sure why it returns that value. But I have mostly been checking if variables are empty or not. In your case, I would use the condition "NOT DOTNETVER3_0 OR NOT DOTNETVER35_SP1". A variable will be empty if the search doesn't return any result.

Anthony Lisbona's picture

Hi Johan

I dont think your suggestion will work. On our test machine, .Net 3.5 was installed, but SP1 wasnt, however both Values still existed in the registry key - the SP one just had 0, 

Therefore checking the existence of the registry key isn't sufficient to determine whether SP1 is installed or not

JohanH's picture

Ok. Probably #1 is because the value is a Hexadecimal value in the registry.

Anthony Lisbona's picture

What would be the best way to reference that value in a Condition then?

DOTNETVER3_0 = #0  or  DOTNETVER3_0 = '#0' doesnt work (a syntax error is given)

If i try DOTNETVER3_0 = "#0" (double quote marks) there is no syntax error, but the condition doesnt seem to be behaving as expected.

JohanH's picture

According to MSDN, literal text must be enclosed between quotation marks. I found the following example from the WiX documentation http://wix.sourceforge.net/manual-wix3/check_for_d.... It is a good idea to also include "Installed" in the condition.

Installed OR (NETFRAMEWORK30_SP_LEVEL and NOT NETFRAMEWORK30_SP_LEVEL = "#0")

Edit. I was about to tell that the WiX documentation explains your problem. Read the last paragraph on the page.

Edit 2. That WiX page has some errors. In my experience you have to use "Not Installed" condition during first installation. The "Installed" condition is true during an Upgrade.

SOLUTION
Anthony Lisbona's picture

The values did indeed have to be surrounded by double quotes when using it in a condition.

EdT's picture

I wrote a couple of articles a while back, on how to detect versions of .NET installed, based around Microsoft articles on the same topic.

Check out this article for the VBScript solution:

https://www-secure.symantec.com/connect/articles/detecting-which-net-frameworks-are-installed-using-vbscript

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Anthony Lisbona's picture

EdT

Thanks for your suggestion. Ill try that as a last resort. 

But according to the Wix article Johan provided, is #1 the correct value that is returned by Wise when using System Search? And if so, what is the correct way of referencing it in a Condition?

EdT's picture

System Search, when applied to searching for a registry key, uses the RegLocator table. If you read up about this table in the help file MSI.CHM, you will find that the # character indicates that the value is a DWORD.  You cannot use this in a condition as the return is not an integer value. 

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Anthony Lisbona's picture

I ended up using it in a Condition, and it seemed like it worked OK?

Condition = DOTNETVER35_SP1<>"#0"

Where: DOTNETVER35_SP1 was the property that was set by the Registry 'System Search' result.

EdT's picture

If it worked, then it suggests that the return "#0" is being treated as a string.

As long as it passes QA, then the solution is viable.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.