calllkp.blogg.se

Advanced installer custom action with do action
Advanced installer custom action with do action





advanced installer custom action with do action

If you don’t want to pass arguments as a key/pair value ( INSTALLLOCATION=), we can change the C# code to get all the arguments that are passed in the session. Now that we have our MSI build, when we install it and the custom actions are executed, it will write the following key in the registry: So in our case, we are going to set the value as a key/pair of INSTALLLOCATION=. For example, in our DLL we are searching if an argument for INSTALLLOCATION is passed, and if it is, the DLL will take it’s value. In the Value field of the Set Installer Property custom action you must write the key/pair set of value. In the Property field of the Set Installer Property custom action you must write the name of the custom action of your DLL (that we previously created) and in our case it’s TestCustomAction.CA.DLL. To do this, in the Custom Actions Page, we need to add a Set Installer Property custom action, and configure it like in the screenshot bellow: In our case the APPDIR internal MSI property is the one which tells the MSI which is the install directory. Ok, now that we have our DLL added as a custom action, we need to pass the MSI install location to it.

advanced installer custom action with do action

In our project, navigate to the Custom Actions Page and add a Call function from attached native DLL custom action and configure it like in the screenshot bellow: We are going to edit the MSI with Advanced Installer.

advanced installer custom action with do action

Using using System using using System.Linq using System.Text using Microsoft.Win32 namespace TestCustomAction Īfter we added our changes in the code, build the DLL from Build > Build Solution. Key.SetValue("yourkey", session.CustomActionData) The only thing I modified in my code is this line:

advanced installer custom action with do action

For this project, I want to write in the registry the INSTALLLOCATION of my MSI. If you had a look over the previous post, our DLL is quite simple and writes only some registry keys. In our DLL, we are going to use the session object and the CustomActionData property. In the last post, we had a look on how to create a C# (CSharp) DLL for MSI Custom Actions, but what if you want to create something more dynamic? What if we want to pass some MSI properties to our DLL, and in our DLL we use those arguments in our code to set things up?







Advanced installer custom action with do action