Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to obtain current installation folder


5 replies to this topic

SharpDog

SharpDog
  • Members
  • 4 posts

Posted 27 September 2004 - 20:40

I am using the windows installer. I have a custom installer dll written in C#.NET based on the System.Configuration.Install.Installer class. When I 'look' in the current directory (EG. FindFirstFile( "*", ...) ) I find that I am in the Windows directory (path to msiexec or whatever). My application has been started by clicking on the .msi file. I intend for it to start when the user downloads this file from the web (so this is a valid simulation). Anyway, is there a method or property to check which can tell me the folder chosen by the user during the installation dialog 'Select Installation Folder'? I have implemented Before & After event handlers for install (and uninstall) actions.


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 28 September 2004 - 09:40

You could try to retrieve the INSTALLDIR or the TARGETDIR properties.
Regards
-Stein Åsmul

SharpDog

SharpDog
  • Members
  • 4 posts

Posted 28 September 2004 - 12:57

Do you know how I can do that? I was looking at MsiGetProperty but I am not sure that is applicable as I don't have a handle?

SharpDog

SharpDog
  • Members
  • 4 posts

Posted 28 September 2004 - 13:13

I can see that if I am coding in C++ I may be able to code an Action function but I do not think this is available to me in the C#.NET versiion? Maybe I am wrong about that? I can also see where this information is available in an install script but I have coded a DLL and not an install script. Can anyone help me out of my confusion?


SharpDog

SharpDog
  • Members
  • 4 posts

Posted 28 September 2004 - 14:11

I found it, the code I needed was:

string sPath = Path.Combine( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location ), "setup.ini");

I found it here: http://www.codeproje...eployingPPC.asp

Thanx all, I hope this helps someone else.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 28 September 2004 - 14:13

I'm not sure if you can access properties from a installer class. If it doesn't work you could write the value to registry (actually setting ARPINSTALLLOCATION should do this) and in your .NET class you can read it from there.