Finding the installer's startup path

SteveD

0
Joined
Mar 28, 2003
Messages
84
Hey guys,

Anyone have any idea how to find the startup path of a Setup Project executable? I need to know this in the Install() function of an Installer class within the app itself.

Application.ExecutablePath returns "C:\Windows\SYSTEM32\MsiRun.exe" (or something similar), because by the time Ive reached the Install() function, Im already within the MSI installer program - I believe.

I any case, I have this scenario:
A CD (though it could just be a directory) containing the setup.exe, my .msi file (which contains the actual app - this app contains the Installer class), and a script I would like to run from inside Install(). Since the .msi run by MsiRun.exe is actually in the same directory as the setup.exe, finding its location would also work.

Any ideas?
 
Unfortunately, no. The best I can come up with (for the time being) is to prompt the user with an "Open File" dialog when the time comes to find the location of the setup files. The Open dialog always seems to go to the correct location (the CD-ROM drive, in most cases), where setup.exe was run. This would imply that my little Installer class knows where its parent was run from - now we just need to figure out how to get that information. :)

If anyone else knows, Id still love to hear. If I find a solution elsewhere, Ill follow up in this thread.
 
Try Environment.CurrentDirectory. I dunno if this will always be accurate, but you could see if the file exists in that location. If it doesnt, then you could always pop up an OpenFileDialog as you are doing.
 
That still seems to point to C:\WINDOWS\System32\, which is where MsiExec.exe is located. Thanks for the idea, though! :)
 
Solution

In case anyone searches and the forum for the same proble, like I did, the solution is this:

In the CustomActionData property of the Custom Action, type:

/DIR="[TARGETDIR]\"

Then in your Installer class, add this code:

Dim path As String = Context.Parameters("DIR")

Et Voila!
 
I am installing my program first in administrative mode. then when i want to place the program on each local machine, i want to be able to get the location of where i placed it on the network. how do i get that location rather than the target location?

littleisharp said:
In case anyone searches and the forum for the same proble, like I did, the solution is this:

In the CustomActionData property of the Custom Action, type:

/DIR="[TARGETDIR]\"

Then in your Installer class, add this code:

Dim path As String = Context.Parameters("DIR")

Et Voila!
 
Back
Top