Newbie Question - how to retain install path
Hi:
We have an application that we install on a local machine. We have another application that calls the installed application. However, for the second application to know where the first application was installed, I need to write the installation path to a registry key. I have been looking over the installer project I have created and there doesn't seem to be a way to retain the installation path once the user has selected it.
Application.startuppath doesn't work since setup.exe is the calling application, not the application being installed. My plan is to insert a custom install action to write the install path to the registry before the installer exits. I just need to now how to get the install path (after the user has selected it).
I apologize if this is a stupid question, but I assumed it would be relatively easy to get and I haven't been able to find it yet.
Eric
Re: Newbie Question - how to retain install path
Ok, figured it out:
1 - add a new project to your application
2 - create a form application with the opacity set to 0 (doesn't hurt to set the visibility to false in your code)
3 - add the code that used Application.startuppath to get this apps path and append whatever exe you want to launch to the path to the form's load event and then add code that writes this path to the registry, the path variable, or whatever storage medium is your preference (i.e. xml file, etc.)
4 - add the primary output from this project to your setup project's application folder
5 - create a custom action in the commit section of the setup project and tie it to this project's primary output in the application folder
Since this small .exe is copied over to the same directory as application being installed, the path its application.startuppath returns is the same as the application installed and by tying it to the installer as a custom action to be executed in the commit phase, you effectively get the installation path.
Hope this helps someone!
Eric