i am trying to create custom windows installer using windows forms. how to create custom action which can accept installation path from windows form for installation. i tried to assign value from windows form to this.Context.Parameters["targetdir"] but the application is installing at default path i.e. C:\Program Files (x86)\Microsoft\Setup1.
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.
creating custom windows installer using winforms
Started by
enigma34
, Nov 03 2012 22:05
3 replies to this topic
Posted 05 November 2012 - 11:35
I'm not sure I fully understand what you are trying to do. In general, I'd suggest using the built in dialogs (or use a completely external UI) instead of displaying dialogs in a custom action.
If you want to set the destination directory using a custom action you need to set the appropriate property. This can only be done form a DLL (or script, but not EXE) custom action using the MsiSetProperty function. You must use the correct property name (e.g. TARGETDIR or INSTALLDIR, depending on how the MSI was authored), you must use the correct capitalization (property names are case sensitive) and you must call your custom action in the correct sequence with the corrrect scheduling settings. If your custom action is scheduled after CostFinalize you have to use MsiSetTargetPath instead of MsiSetProperty.
For debugging purposes, generate a verbose log file of the install. It will tell you if and when the property value changed.
If you want to set the destination directory using a custom action you need to set the appropriate property. This can only be done form a DLL (or script, but not EXE) custom action using the MsiSetProperty function. You must use the correct property name (e.g. TARGETDIR or INSTALLDIR, depending on how the MSI was authored), you must use the correct capitalization (property names are case sensitive) and you must call your custom action in the correct sequence with the corrrect scheduling settings. If your custom action is scheduled after CostFinalize you have to use MsiSetTargetPath instead of MsiSetProperty.
For debugging purposes, generate a verbose log file of the install. It will tell you if and when the property value changed.
Stefan Krüger
InstallSite.org twitter facebook
Posted 05 November 2012 - 12:58
I think you are trying to create the installer UI using WinForms as you do not want to use Basic MSI UI. In this case, you can run your UI and gather all info needed and create PUBLIC PROPERTIES out of them. For example:
Gather the installation directory from the user, create the INSTALLDIR variable in you WinForms UI program and assign it the value entered by user.
Then, invoke the msiexec.exe from your UI program like below:
msiexec.exe /i <PATH TO MSI> INSTALLDIR=VALUE
Look here for complete details:
http://msdn.microsof...8(v=vs.85).aspx
Gather the installation directory from the user, create the INSTALLDIR variable in you WinForms UI program and assign it the value entered by user.
Then, invoke the msiexec.exe from your UI program like below:
msiexec.exe /i <PATH TO MSI> INSTALLDIR=VALUE
Look here for complete details:
http://msdn.microsof...8(v=vs.85).aspx