views:

191

answers:

2

How can I get the directory that an application is being installed to from within the custom installer class?

What we are trying to solve is the age old problem of *.config files for multiple environments. One idea we were kicking around was having the configs stored on a network share, and the installer would copy over the correct one. Currently we use the method described on Scott Gu's blog, but we would like the files to be out of dev's hands.

A: 

As a work around, perhaps you can have the app copy that file when it is first run. The app knows where it's running from.

lod3n
A: 

I have found that this.Context.Parameters["assemblypath"] will get you the file location of the primary output (c:\program files\Company\MyAssembly.exe). You can always parse out the path from that. It isn't the best solution, but it will work.

Joe