When my ProjectInstaller : System.Configuration.Install.Installer
is called by the Setup project the current path is c:\windows\system32
. How can I get the path where the application is being installed without hard coding this to the project ? (the destination path is something like c:\program files\[manufacturer]\[service name]
)
Asked
Active
Viewed 2,700 times
1

Jon Seigel
- 12,251
- 8
- 58
- 92

Jader Dias
- 88,211
- 155
- 421
- 625
-
By curiosity, what are you trying to achieve with the destination path in the projectinstaller? Just curious – pdiddy Jan 14 '10 at 22:06
-
My Windows Service project don't know its own name, by design, so I can reuse it to host many different WCF services. But to run multiple instances of it, it needs to get a different name for each instance. The best name is the folder name where it is installed. – Jader Dias Jan 14 '10 at 22:08
-
If I can get the folder name, I can give a proper name to the instance. – Jader Dias Jan 14 '10 at 22:09
2 Answers
1
This question is perfectly answered by the method described in the link below:
How to make a System.Configuration.Install.Installer to get a variable from the Setup project?

Community
- 1
- 1

Jader Dias
- 88,211
- 155
- 421
- 625
0
string path = System.Reflection.Assembly.GetExecutingAssembly().Location

Mose
- 1,781
- 3
- 16
- 35
-
It will work if the assembly that contains the installer is in the application's folder which is usually the case. – Jecho Jekov Sep 27 '17 at 20:51