Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

zig?
Posted

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.

zig?
  • *Experts*
Posted
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.
  • 5 months later...
Posted

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!

Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...