![]() ![]()
ADVANCED INSTALLER COMMAND LINE PARAMETERS ACTION DATA HOW TONow, let's go to some code so that I can show you how to read it from the context into some strong type variables, and then persist it into the state dictionary so that the command line parameters can also be used during an uninstall.įirst, let's take a look at the InstallerCustomActions class. So far so good, we've got the data from the command line to the installer's InstallContext property. As you might have guessed, the CustomActionData property is case sensitive when it lines up the value names to the actual value in the installer's internal property directory. 1, you'll see that when the command line was parsed, the value names were all converted to uppercase. If you refer back to the log file captured in Fig. The value names must be uppercase, or they will not be found in the Properties collection from the installer's internal property dictionary. The square brackets indicate that the value is to be filled in from the Properties collection. Next, notice that the values are surrounded by square brackets, and are upper case. ADVANCED INSTALLER COMMAND LINE PARAMETERS ACTION DATA INSTALLThese are necessary to enable values with spaces to be passed into the Install Context from the command line. First, notice the quotes around the values. 4, as that's where a lot of the magic is happening. OK, I want to spend a little time with Fig. 4: Attach the values for each command line argument to new arguments that will be attached to the installer's InstallContext property when your custom action is run. 3: Add the primary project output to the Install Custom Action.įig. Let's go ahead and add the primary project output for your application to the Custom Actions, and setup the CustomActionData property to map the command line arguments to your Custom Action's InstallContext.įig. 1) through more arguments that you specify in the custom actions screen in the setup project! Some pictures here are worth about a million words. It turns out, that you have to pass the values from the Property internal collection (Fig. The problem was that the Installer Custom Actions didn't seem to have any visibility to the command line arguments when the installation was run from MSIEXEC. While I was pretty excited to see that the command line parameters were parsed and stored into this internal collection, I had no idea how to get at the data after that point. M圜ustomParameter=one MyOtherCustomParameter=two ![]() To generate the data in the above screen, I used this command line: 1: Some of the properties that you have access to from a custom action. You can get a list of the contents of this collection by running any MSI file, and specifying the /l* parameter.įig. This collection also houses the well known parameters such as TARGETDIR, and others. The trick to the solution is that the command line parameters are added to a special collection inside the guts of the setup framework. I'm going to lightly cover adding the custom action, but I'm going to focus on passing the command line parameters to the custom action, and managing the data through to the uninstallation of the application. There are loads of articles out on the internet that show you how to create custom actions that your setup package can run to show custom dialogs, and perform other types of actions during an installation. There were several stumpers that I encountered while working on this solution, which instantly got my documentation juices flowing, so now it's article time! The Solution
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |