Extract Install Location After Setup

jdemackio

Active member
Joined
Jun 8, 2004
Messages
42
Hey guys, Ive inserted a setup project into my .NET solution and fooled around with it enough to install everything properly. I figured out how to retrieve the serial number from the registry after installation but I cannot retrieve the application path that the user selected during the install. Any help would be appreciated.
 
Disregard

I guess this one is harder that I originally thought since nobody replied. Anyhow, I figured out a trick that extracts the location of the app.
 
The trick has to do with the FirstRun registry setting thing that I was talking about before. Basically, the first time your application is opened, you will extract the installed location by calling:
Dim strInstallPath As String = System.IO.Directory.GetCurrentDirectory
This returns the path of where the application is running from (the installed directory). Write this path to the registry or a file so that your app will reference it everytime it is opened.
If you dont like the FirstRun thing, then just use the above code on the Load event of your startup Form and store the path into a global variable for easy referencing throughout your app.
 
Thank you for the quick reply. But I guess I understood something different. I wanted to extract the Install location during the setup.

Anyway, meanwhile I figured it out. Maybe you are interested:

I am executing a custom action (exe) which needs to know the installpath [TARGETDIR] the user has chosen. So according to all I have read I tried to pass it as CustomActionData and this never worked. Finally I just moved the [TARGETDIR] up to the argument section and there it goes.

Last little detail: to receive the argument in the CA.exe you have to cut off the final backslash of the string.

What I am a little p.. off is that I have not found any hint in a couple of hundreds of helpfiles and forum posts. All stuff Ive seen only talks about creating another installerclass to pass this silly little argument. And I just thought by myself that this was exagerated and that there must be a simpler way. Ok, and here it is!

So, have a nice evening, guess in australia it must be about 21 hs. Here it is early morning. Greetz

Fritz :cool:
 
Back
Top