Getting the installpath in the installer class

S

Sagaert Johan

Hi

How can i get the path used for installation (usually c:/program
files/[Company]/[productname] or the one where the user browsed to in the
setup wizard ) from inside the installer events in my custom installer
class ?

Johan
 
L

Larry Smith

How can i get the path used for installation (usually c:/program
files/[Company]/[productname] or the one where the user browsed to in the
setup wizard ) from inside the installer events in my custom installer
class ?

The code where you're executing this (an "Installer" derivative presumably)
likely exists in an assembly that was installed in the installation folder
itself so try this:

string installFolder =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
 
F

Family Tree Mike

L

Larry Smith

You need to pass [TARGETDIR] to the custom action as part of the

He should investigate this carefully first. There was a problem associated
with this technique when I first tried it myself a couple of years ago (in
VS 2005). I'd have to dig the details up again but can't do that until
Tuesday. Will post back here if I can find it but hopefully it's been fixed
by now.
 
S

Sagaert Johan

thanks ;

meanwhile i found this is also working :

this.Context.Parameters["assemblypath"];



Larry Smith said:
How can i get the path used for installation (usually c:/program
files/[Company]/[productname] or the one where the user browsed to in
the setup wizard ) from inside the installer events in my custom
installer class ?

The code where you're executing this (an "Installer" derivative
presumably) likely exists in an assembly that was installed in the
installation folder itself so try this:

string installFolder =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top