Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

disappearing properties


7 replies to this topic

ad_p

ad_p
  • Members
  • 1 posts

Posted 04 February 2004 - 10:36

Hi,

I have a problem with DevStudio 9. The target machines that our MSI's are to be installed on should have a registry key that contains a path. I want to be able to read this path and then install components to it. If the registry key is not found, the component needs to install to a hard coded path, i.e. d:\MyFolderName\SubFolder.

I came up with the following method to do this:

1) Go through the system search wizard, using the "Registry entry that contains other data" type. Store the result in a property called FOUNDPATH. (Don't set it to be a condition)

2) Create a Property MYPATH in the Property Manager that contains the default path like C:\temp.

3) Go to the component, click on the Destination field and click on the three dots. Right click on the destination computer icon and select new. Name the folder MYPATH and also name its Directory Identifier MYPATH.

4) Create a custom action of the type "Set Directory". Set the directory name to MYPATH, the directory value to [FOUNDPATH] and the install exec condition to FOUNDPATH.

5) Schedule this custom action in the Execute sequence after CostFinalize.


This technique seems to work ok, but the problem is that the component needs to be installed to a subfolder of the path in the registry. So if the registry contains the path d:\Network\Manage, the installation needs to create a subfolder and install the component to d:\Network\Manage\Component.

I thought the best way to do this was to go to the Destination field of the component, bring up the browse for directory window, then make a subfolder of [MYPATH]. However if i do this, MYPATH disappears from the property manager, and if the registry key does not exist, the installation creates a folder called MYPATH.

What is going on? Am I doing something stupid, or is this a devstudio 9 bug?

Thanks

Adam


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 04 February 2004 - 13:10

Properties that are used as destination for components will automatically get added to the directory table and are not needed in property table. If you specify a sub folde rin the component properties a new directory table entry will be created, which is not what you want.

I'd suggest you keep MYPATH as destination, and change your custom action to set MYPATH to [FOUNDPATH]Component\


grantmi

grantmi
  • Members
  • 8 posts

Posted 27 February 2004 - 11:00

System Search on Registry key
If an old product is installed I don't want to install my new one.

If an old product is installed the following key is in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{42020FA9-9027-11D0-B29B-00A024A53DE6}

So I setup a Sytem Search:
I choose Registry Entry that contains other data.
Registry Root = "HKEY_LOCAL_MACHINE"
Registry Key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{42020FA9-9027-11D0-B29B-00A024A53DE6}"
I store it in Property = "INSTRON_OLD_CONSOLE"
I don't enter a Registry Value so I am searching for "(Default)"

Then I setup the following Install Condition in General Information - Product Properties:

NOT INSTRON_OLD_CONSOLE

with Message "An old version of Console is installed"

When I test my installation it always runs even when the registry key is there.

Can you tell me what I am doing wrong?

I tried both defining INSTRON_OLD_CONSOLE in the Property Manager and not defining it. This seemed to make no difference.
Does it make a difference if you enter it into Property Manager or not?

PS. I used to look for a file in a system search and set the INSTRON_OLD_CONSOLE property and had the same Install Condition and this seemed to work!
But checking the registry entry is a much more certain way to see if an old product is installed, so I deleted the Sytem search for the file and created one to search the registry, but it just doesn't seem to work.

Any help gladly appreciated!
Cheers Mike



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 February 2004 - 14:09

My first idea was that you may have a condition on the AppSearch action preventing it from running, or that LaunchConditions is coming before AppSearch in your install sequences. (Can you please check these?)

Does that default value in registry exist and have a not-empty string value? if INSTRON_OLD_CONSOLE is set to an empty (null) string the condition will also evaluate to true.
A log file or the debugger should tell you the actual value of the property.

grantmi

grantmi
  • Members
  • 8 posts

Posted 27 February 2004 - 15:28

Hi Stefan

Your second gues was correct! Unfortunately I discovered it before I read your post. But well done, full marks!

PS. I don't seem to be able to see what my properties get set to in the Logfile.
I do:
msiexec /i blabla.msi /Lp Output.txt

I get the output.txt and I see lots of properties but not INSTRON_OLD_INSTALL
WHy?

For the full story on where I went wrong in the above post see below:


It seems DevStudio Help is a bit misleading!

Where I went wrong was to leave the "Registry Value" field blank when I was setting up the System Search.

The Help says it will then look for the (Default) registry value for that key. This is actually correct but mislead me to beleive that even if the (Default) registry value was "(value not set)" my Property would be set to True.

This is not the case. If you leave the Registry Value blank it does search for the (Default) value, BUT if this is "Value not set" (which is the default when a registy key is created) your property gets set to an Empty string which evaluates to False.

When you understand that when you do a System Search on the Registry, your Property (which you want to be set depending on what you find in the registry) gets set to the Registry Data associated with the Registry Value you are looking for. So it makes sense that if the Registry Data is "(value not set)" ie. It is not set, it is an Empty string. Then you would expect your property to be set to an Empty string.

So, it seems you can't actually search to see if a particular Registry Key exists without it actually having a Registry Value under that key which is set to something.

Shame it took me 2 days to work this out.

I am sending this info to Installshield so they can improve the help topic for System Search Wizard.



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 February 2004 - 16:09

QUOTE
I get the output.txt and I see lots of properties but not INSTRON_OLD_INSTALL

A property that doesn't have a value (that inlcudes an empty string) is non-existant or undefined, and therefore not listed in the log.
QUOTE
This is actually correct but mislead me to beleive that even if the (Default) registry value was "(value not set)" my Property would be set to True.

"(value not set)" is how regedit.exe displays a non-existing entry. In this case it means that the default value is not an empty string ("") but non-existent. This is only a marginal difference, and no difference at all for MSI. Anyway: "(value not set)" is not what Windows APIs return if you read a non-existing entry, it only exists in regedit.exe's UI.
QUOTE
It is not set, it is an Empty string. Then you would expect your property to be set to an Empty string.

There is no way to set a property to an empty string in MSI.
QUOTE
So, it seems you can't actually search to see if a particular Registry Key exists without it actually having a Registry Value under that key which is set to something.

That's correct. You may want to search for the UninstallString entry instead

grantmi

grantmi
  • Members
  • 8 posts

Posted 27 February 2004 - 16:24

Hi Stefan

Thankyou for the information on why I can't see my properties in the log.

I will look for the Registry Value "DisplayName" under the following Registry Key and then all will be well.

Registry Key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{42020FA9-9027-11D0-B29B-00A024A53DE6}"


PS. If I create INSTRON_OLD_CONSOLE in the Property Manager and give it some value will the System Search overwrite it if the key is there and leave it as it is if the Registry value is not there?

CHeers Mike

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 February 2004 - 16:34

I'm not sure. You'd better try it.