Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Project setup
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 18-Jun-13 6:37am
Comments
Sergey Alexandrovich Kryukov at 18-Jun-13 12:14pm
   
What are you using for the setup project?
—SA
Member 9714971 at 19-Jun-13 3:13am
   
I'm using Visual Studio 2008
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Member 9714971 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hope this thread will solve the custom action problem you are facing
link[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 19 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100