Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm a beginner. I have recently developed an application in C#. Now I wanna develop its setup. I would like to change programmatically the Default Location of the program, I mean that I would like to set the default location to the location of a program previously installed on the client machine. However I don't know what is the installation path of this other program, so I have to find it programmatically in the registry with a custom action, but I'm not able to launch a custom action before the Installation dir has been already set to the default one.

Is there someone that could help me?
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jun-13 12:14pm    
What are you using for the setup project?
—SA
Sara Noemi 19-Jun-13 3:13am    
I'm using Visual Studio 2008

The ideal way to find a program's installation path is to read it from the registry.Installers usually create a registry key for programs that contains their installation path.

To find if the program has a key in the registry, open "regedit.exe" and use the Edit , after that Find option to try and locate a key with the program name. If such a key exists, you can read it using the RegistryKey class in the .NET Framework library.

If the program does not have a registry key then another option is just to ask the user to locate the .exe file with the OpenFileDialog, although this is obviously not ideal.

Hope that will help, Please mark as answer.
 
Share this answer
 
Comments
Sara Noemi 19-Jun-13 3:18am    
Thank you for the information. I know that I can retrieve the installation path from the registry and that is the way I use in the custom action, by the RegistryKey class, to find the path of the other program. However I'm not able to launch the custom action before the Installation Folder form has been shown. What I would like to do is:
- find the path of the other program using the RegistryKey class
- set the path found as Default Location of my program
- install it

I hope that now it is more clear.
Hope this thread will solve the custom action problem you are facing
link[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900