cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kmaddal39
Level 4

Retaining Registries on Major Upgrade

Hi,

I'm trying to build a Major Upgrade for my solution. I understand that a Major upgrade means, uninstalling all the components of the previous version and then installing new components. My only aim is to retain the registry values of the previous version. I came to know that there is no direct way of doing this. So, I've tried to implement two custom actions to do the job for me. I have written an executable that writes registry values of the previous version into a file and also reads registry values from the file and load them into registries based on the respective argument. My only problem is the sequence that I have to set to achieve my requirement. When I run a Major upgrade setup file, I want the "writing to a file" custom action to happen even before the uninstallation of the previous version and I want the "loading from file" custom action to happen after new registries are created for the newer version. I'm not able to get this done. I would really appreciate if someone can help me out with this. Thank in advance.

Regards,
Koushik Maddali
Labels (1)
0 Kudos
(11) Replies
DLee65
Level 13

Koushik,

You can do what you want without a custom action. Use the MSI built-in action for App Search for each registry value. For each value set a property value. IF these property values are empty then configure the MSI to set a default value.
0 Kudos
kmaddal39
Level 4

Thanks for the response Dan. I'm new to InstallShield. I'll checkout the App-search. Is there any documentation that could help me with this procedure?
0 Kudos
DLee65
Level 13

No problem.

MSDN lists the technical description of the appsearch table.: https://msdn.microsoft.com/en-us/library/windows/desktop/aa367579(v=vs.85).aspx
Robert Dickau has a good article discussing properties: https://resources.flexera.com/web/pdf/archive/MsiPropUninst.pdf
InstallShield help doc: http://helpnet.installshield.com/installshield23helplib/helplibrary/FAQRegistryReadData.htm
please note the link in this help doc to the System Search. System Search is the UI feature of the InstallShield development IDE that will setup the AppSearch table for you.

0 Kudos
kmaddal39
Level 4

Thanks a lot for taking time to help me out Dan. I tried following the instructions provided, but no luck. I understood that there are 2 phases in this. First one is to search for an existing registry and save it's value to a property. Second phase is to use this property value as the default value for the new registry that I have created with the installation.
To achieve this,

I have created a property "APPNAME" and then created a system search and selected APPNAME as the destination to store the value of the registry. Then, I tried to use [APPNAME] as the default value for my new registry. Is this the right way to load a property value as a default registry value? Below are the msi logs that came out with my try. Please take a look,

Mentioning Line numbers to give an idea of the sequence.


Line No: 118


Action start 10:10:27: AppSearch.
AppSearch: Property: APPNAME, Signature: NewSignature1
MSI (c) (88:F4) [10:10:27:801]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (c) (88:F4) [10:10:27:801]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE32\SYSTEM\CurrentControlSet\Services\TSAgent\APP_NAME 3: 2
Action ended 10:10:27: AppSearch. Return value 1.

Line No: 1027

WriteRegistryValues: Key: \SYSTEM\CurrentControlSet\Services\TSAgent, Name: APP_NAME, Value: 0
MSI (s) (64:F4) [10:10:32:942]: Executing op: RegAddValue(Name=CONFIG_SAVED_ON,,)

Line No: 1212

Property(S): APPNAME = 0

Line No: 1412

Property(C): APPNAME = 0

Is there any problem with saving registry value to property or is it a sequence issue?
0 Kudos
DLee65
Level 13

I think the problem is that your test did not find a value in the registry key you provided. I do not see any indication that the appsearch modified a property value. Below is an install log file from my setup.

[CODE]MSI (s) (D4:70) [09:01:21:637]: Doing action: AppSearch
...
MSI (s) (E4:6C) [14:07:23:401]: PROPERTY CHANGE: Adding AC_INSTALLED property. Its value is 'C:\EHR Fabulous applications for my Great Practice\Amazing Charts\'.
MSI (s) (E4:6C) [14:07:23:401]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE32\SYSTEM\CurrentControlSet\Services\UltiDev Cassini Web Server for ASP.NET 2.0 3: 2
[/CODE]

It is not a sequence thing because as you see this runs early.
For the line that shows the install path value, this System Search succeeded and so in my log I just see the property, AC_INSTALLED, set. In System Settings: I have the following
* Registry Root: HKEY_CURRENT_USER
* Registry Key: Software\...\STARTUP (this is the full registry path to get to the key name)
* Registry Value: InstallPath

I set this to 'store in' AC_INSTALLED' property.

Look at how you configured the registry key and ensure that the key exists on your test platform.

You are on the correct path. You are correct, that to write a property value to the registry, use the square brackets around the property name.
0 Kudos
kmaddal39
Level 4

Your'e my savior, Dan. The way I have configured my key is indeed the issue here.

Registry Root: HKEY_LOCAL_MACHINE
Registry Key: SYSTEM\CurrentControlSet\Services\TSAgent\APP_NAME
Registry Value:

I have changed the above config to

Registry Root: HKEY_LOCAL_MACHINE
Registry Key: SYSTEM\CurrentControlSet\Services\TSAgent
Registry Value: APP_NAME

It worked!!! I need to finish testing the entire parent registry on Major upgrade changing the product codes. Hope I don't encounter any other hiccups. Thanks a lot, Dan. I really appreciate you're concern.

Regards,
Koushik Maddali
0 Kudos
DLee65
Level 13

The registry value is the name of the data you are trying to preserve.
Let's say you have a .REG file with the following:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance]
"Close"="CloseCtrs"

Registry Value should be 'Close' to get the string data type "CloseCtrs".
If you leave 'Registry Value' empty, then you will get the default value. My guess is that the default value for TSAgent is empty, that is why your test failed.
Look at the registry key for TSAgent, what is the specific Registry Value data you are trying to preserve? That is the value you need for the 'Registry Value' entry in System Search.
0 Kudos
kmaddal39
Level 4

I've edited my previous reply instead of creating a new one. My bad!! It worked, Dan. When you asked me to check my config, I've tried giving the key name into the registry value field. It worked. Thank you so much man. I really appreciate for helping me out.
0 Kudos
kmaddal39
Level 4

DLee65 wrote:
The registry value is the name of the data you are trying to preserve.
Let's say you have a .REG file with the following:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance]
"Close"="CloseCtrs"

Registry Value should be 'Close' to get the string data type "CloseCtrs".
If you leave 'Registry Value' empty, then you will get the default value. My guess is that the default value for TSAgent is empty, that is why your test failed.
Look at the registry key for TSAgent, what is the specific Registry Value data you are trying to preserve? That is the value you need for the 'Registry Value' entry in System Search.



Got into something weird, Dan.

I have a DWORD registry with value 10. My AppSearch resulted this,

AppSearch: Property: RECONNECTINTERVAL, Signature: NewSignature112
MSI (c) (44:A0) [13:16:46:003]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (c) (44:A0) [13:16:46:003]: PROPERTY CHANGE: Modifying RECONNECTINTERVAL property. Its current value is '10'. Its new value: '#10'.

And when the value of the RECONNECTINTERVAL property is set to the new DWORD registry, it converted as a STRING registry with value #10.

Do you know what's going on here?
0 Kudos
kmaddal39
Level 4

SOLVED!!! No worries, Dan. I've gone through few posts regarding the same issue. I've created STRING registries instead of DWORD and changed the property values from int to #int. It worked. Thanks.
0 Kudos
kmaddal39
Level 4

Thanks for everything, Dan. I have been working on implementing Custom Action approach but it went no where. Your guidance helped me a lot. I have a full working POC. I'll be testing the upgrade with my actual solution tomorrow. Will update you. And, I would like to bring something else to your notice. It's been more than a week that I've created a post regarding setting Using Installer Class set to true but found no help. I would really appreciate if you could guide me on this too. Below is my original post,

Hi,
Long story short, I have used InstallShield 2015 Professional to manage my solution's(windows service) installation. Now, I've got a requirement to do some logic before Uninstall. So, I've overridden onBeforeUninstall() event handler of Projectinstaller to do necessary logic for me. I've tested this functionality using InstallUtil uninstall command and everything worked fine. But, when I used my Installshield to uninstall, I'm not even getting control into my onBeforeUnsintall(). After browsing for some time, I came to know that I need to set User Installer Class to true to achieve what I need. But, after changing the value to true, I'm getting Error 1001 right when I'm installing my setup file. I would be really thankful if someone could help me out with this. Thanks.


I really need to make InstallShield use InstallUtil.exe to uninstall my service. Could you please help me with this. I can share my logs as well. Looking forward. Thanks.

Regards,
Koushik Maddali
0 Kudos