Hi,
Should the method in the .NET code accept a single Session parameter and get parameters from session.CustomActionData, or should I accept 2 strings as normal?
From your post I think converting your DLL to a .NET Installer class action would be the best approach.
For an installer class action you can set parameters which can be retrieved from
Context.Parameters inside the action code. This works only when adding a ".NET Installer Class Action" custom action in your project. It doesn't work for any .NET DLL.
If you want to use an installer class action, you can find a tutorial here:
http://devcity.net/Articles/339/1/article.aspx
Please note that an installer class action can use only installed files. So the DLL will need to be installed on the target machine. If you really want to remove it, you can make sure that
it's component is not registered with Windows Installer. This way you can use a simple custom action which deletes it when installation finishes.
The installer session can be used only in DLL custom actions that can receive the installation handle. Usually only win32 DLL or VBScript actions. So using CustomActionData property or ActionData field won't work the way you want.
If you want to use the installer session, you can try creating a
C++ DLL custom action. In this case you can use an Attached custom action so you won't need to install the file.
Should I use a New Attached Custom Action
No. This type of custom action supports only Win32 DLLs and VBScript files.
ShouldI use a New Installed Custom Action
No. It has the same limitation as an Attached action.
If I need to call a .NET installer class, what goes in the Action Data to pass in 2 string parametersameters
This type of custom action pre-populates Action data with it's required parameters. You can also add your own custom parameters which can then be accessed from within your code.
when the guide says the code must inherit the "Installer" class, where is this class
It's "System.Configuration.Install.Installer" class. The tutorial I mentioned should explain everything you need to know about installer class actions.
How can I make sure the CustomAction.dll file does not remain on the system
For an installer class you will have to remove it after installation, for example through another custom action.
Also I suspect the next thing I will need to do is run a custom action on a file that the user selects in the UI.
This is not supported by Windows Installer or Advanced Installer. You would have to write your own custom action which gets the file path and calls functions from the target file.
Regards,
Cosmin
FOLLOW US
Get the latest news in Application Packaging