rvnax.blogg.se

Advanced installer custom action launch msi
Advanced installer custom action launch msi













advanced installer custom action launch msi

We need to set a delimiter for the arguments, and in this case i’m going to use “ ”.įirst, let’s go into our MSI and modify our Set Installer Property custom action like this. When you build and install the MSI, the result will be the same:īut what if you have more than one argument that you want to pass? It’s also simple.

advanced installer custom action launch msi

Instead of setting the value to INSTALLLOCATION=, we are only going to use : One additional change we must perform in our MSI is in the Set Installer Property custom action. Now all the arguments we pass in the MSI will be gathered by the DLL. Then, we use our data variable to write in the registry: key.SetValue("yourkey", data) With this in mind, we can create a variable like this: string data= session 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.

advanced installer custom action launch msi

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. 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. 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: 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 launch msi