steved Posted October 10, 2003 Posted October 10, 2003 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 I've reached the Install() function, I'm 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? Quote zig?
CookieMonster24 Posted October 16, 2003 Posted October 16, 2003 Did you ever solve this? I'm doing something similar to this and i'm stumped. Quote
steved Posted October 20, 2003 Author Posted October 20, 2003 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, I'd still love to hear. If I find a solution elsewhere, I'll follow up in this thread. Quote zig?
*Experts* Volte Posted October 20, 2003 *Experts* Posted October 20, 2003 Try Environment.CurrentDirectory. I dunno if this will always be accurate, but you could see if the file exists in that location. If it doesn't, then you could always pop up an OpenFileDialog as you are doing. Quote
steved Posted October 20, 2003 Author Posted October 20, 2003 That still seems to point to C:\WINDOWS\System32\, which is where MsiExec.exe is located. Thanks for the idea, though! :) Quote zig?
littleisharp Posted April 2, 2004 Posted April 2, 2004 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! Quote
BlueJay924 Posted April 3, 2004 Posted April 3, 2004 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? 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! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.