Windows Installer - Assembly Installation and Management
Posted April 9, 2003
Chat Date: March 6, 2003
Please note: Portions of this transcript have been edited for clarity
Chat Participants:
- Carolyn, a developer on the Windows Installer team
- Chris, a developer on the Windows Installer Team
- Stan, Win32 Side by Side team developer in test
- Jon, developer in the Windows group
- Roberto, a tester on the Windows team
- Eric Sassaman, Windows SDK Community Lead (PSS)
Moderator: Eric (Microsoft)
Welcome to today's chat. Our topic today is Windows Installer - Assembly Installation and Management.
We are pleased to welcome our expert hosts for today! Hosts, please introduce yourselves.
Host: Carolyn (Microsoft)
Hello! I'm Carolyn, a developer on the Windows Installer team. I have been on the Windows Installer team for almost four years and specialize in patching and upgrades, digital signatures, and overall architecture.
Host: Chris (Microsoft)
Greetings! I'm Chris, a developer on the Windows Installer Team. I've been working on MSI for about four years, with my areas of focus including custom actions, security, validation, source resolution, and overall architecture.
Host: Stan (Microsoft)
Hi, I’m Stan Kirilov from Win32 Side by Side team. I am developer in test and I have been with the team for three years. My area of expertise is Win32 Assemblies.
Host: Jon (Microsoft)
I'm Jon - a developer in the Windows group for three years now, working on unmanaged side-by-side assembly support. My areas of work include installation, signing, and validity checking.
Host: Roberto (Microsoft)
Hi, my name is Roberto. I am a tester on the Windows team and have been with the team for 2 1/2 years. My area of expertise is managed assemblies.
Host: Carolyn (Microsoft)
Q: What version of installer will support installation o multiple instances?
A: Are you talking about multiple instances of the same assembly or multiple instances of the same product? For multiple instances of the same product, there is support using multiple instance transforms in Windows XP SP1 and Windows Server 2003.
Host: Stan (Microsoft)
Q: Re: multiple instances, is there support for installing multiple instances of an assembly?
A: Are you asking about installing different (multiple) versions of an assembly? You can have different versions of global assembly installed.
Host: Carolyn (Microsoft)
Q: Are there plans in the future (or current methods you recommend) for setting code group policies rather than invoking caspol.exe directly (or writing custom C# code)?
A: Unfortunately we aren't able to answer this question, but I would recommend that you post it to the microsoft.public.dotnet.security newsgroup where there should be some experts that have more knowledge about caspol.exe and its future plans.
Host: Roberto (Microsoft)
Q: If you install ProductA-Instance1 which installs Assembly A1 to the GAC and then install ProductA-Instance2. What happens when you uninstall ProductA-Instance2? Does it remove it from the GAC?
A: If ProductA-Instance2 installed the assembly into the GAC then when you uninstall ProductA-Instance2 no it will not remove the assembly from the GAC. Since ProductA-Instance1 still needs it.
Host: Stan (Microsoft)
Q: So GAC supports reference counting?
A: Yes.
Host: Roberto (Microsoft)
Q: How do assemblies support auto-repair?
A: Do you mean Install On Demand? If an assembly was missing from the GAC/app dir, and a User launched an app that required that assembly, Then MSI will re-install the assembly.
Host: Carolyn (Microsoft)
Q: (low-priority MSI question) Any reason why the MsiSequence API doesn't generate the same sort of verbose log information for custom/standard actions as we see when scheduled normally in Install*Sequence?
A: Most logging during an installation is handled from the main installation engine thread. If you are calling MsiSequence from a custom action or via some other method, then that could explain why you are seeing less information. This is part of the reason why logging for nested installation custom actions is usually less verbose than logging from the main installation. Note that there have been some improvements in how much information is logged in Windows Server 2003.
Host: Chris (Microsoft)
Q: Should we continue to create custom actions in C, or would you recommend we use the .net installer class instead?
A: At this point, this is really personal preference. Managed actions are a bit more difficult to use in an MSI, especially if you are trying to use an assembly that is being installed by the package itself. This is due to the transactional model of the installation, which doesn't actually commit to the GAC until the end of the script so that rollback can remove the GAC assemblies. Because of this, actions using the installed assembly which load it from the GAC are required to be commit custom actions, which execute after the commit phase. This is something we're looking at making easier in the future, but there are no definite plans at this point.
Host: Jon (Microsoft)
Q: Multi-Instance: for regular components we have to make sure resources are installed to different locations. Is this not true for assemblies in the GAC?
A: It's possible to ship the same publicly visible assembly more than once with different component IDs. However, the managed GAC single-instances them all and does the proper refcounting. If you install the assembly to a place other than the GAC, then the normal rules for components apply.
Host: Carolyn (Microsoft)
Q: Are there any future plans to enhance installation programs through Visual Studio .NET to include the .NET Runtime? As well as the ability to automatically notify the installation program that a previous instance might exist in the GAC?
A: I can't comment on the future plans for VS .NET to allow you to include the .NET runtime in your setup, but can you clarify what you mean by the ability to automatically notify the installation program that a previous instance might exist in the GAC? Are you referring to AppSearch functionality that would let you search for an assembly?
Host: Carolyn (Microsoft)
Q: Are you referring to AppSearch functionality that would let you search for an assembly? Yes
A: Interesting request. What would you like to accomplish with this functionality? In essence, why do you need it?
Host: Chris (Microsoft)
Q: (low-priority MSI question) Why when I import a COM reference for msi.dll into my .NET application does the generated COM-Callable wrapper not include the Classes? Just the interfaces and enums are translated.
A: This is a known behavior of the windows installer DLL when imported as a COM reference. You can use the pinvoke functionality to access the MSI API set.
Host: Jon (Microsoft)
Q: Should companies outside of Microsoft use GACUtil (via custom action) to install assemblies from within an .msi package?
A: You should avoid using GACUtil to install managed assemblies for several reasons. First, you lose the ability to trace installation references in the GAC, unless you use the /r option to add tracking references. Second, GACUtil is part of the frameworks SDK, and is not guaranteed to be on all target machines - it's also not marked as redistributable, so you'd need to check the licensing to make sure you can actually ship it in your package. Third, MSI installation gets you repair and servicing for free, where GACUtil doesn't. Finally, GACUtil is more about populating an empty GAC from the start (as in the case of the frameworks installer) than about installing assemblies on a running system.
Host: Carolyn (Microsoft)
Q: (low-priority MSI question) Can you think of any other things we might see behave differently inside MsiSequence as opposed to running in Install*Sequence tables?
A: You have to be more careful about what table you are sequencing and the actions contained within it. For one thing, you need to be sure you don't deadlock by making re-entrant calls into standard actions. There could also be some problems with certain standard actions. Actions like CreateShortcuts use the underlying Shell Win32 API and have some restrictions on how they can be called. Additionally, during an Installation the Installer handles switching from the client to the service so that it can perform the install with the necessary privileges. Generally the recommendation for using the MsiSequence API is to use it to execute a custom table of actions. For example, the validation engine uses MsiSequence to run the custom validation sequence table _ICESequence which has the list of custom action validators.
Host: Jon (Microsoft)
Q: MCasper: True, only a few unmanaged assemblies show up in-the-box on Windows XP. However, the technology is being used as The Way to ship unmanaged components now, now groups such as the Data Access Components (MDAC), XML (MSXML), Windows HTTP, and
A: Real Time Communications (RTC, the Messenger gruop) are all shipping components and applications as unmanaged assemblies.
Host: Chris (Microsoft)
Q: Is there a mechanism to do the reverse of Merge() or MergeEx() functions. What I am essentially wanting is to update the components in MSI with the contents of a newer MSM.
A: Unfortunately not. This is often an intractable problem. Once a MSM has been merged into a MSI, it is impossible to 100% correctly determine that any particular row came from an MSM. This is especially true with Configurable Merge Modules or complex Directory table merges. You can often come close by cross-referencing the rows in the MSM with the MSI, but you won't be able to correctly detect collisions which were resolved at merge time.
Host: Carolyn (Microsoft)
Q: Workaround (low-priority MSI question) Our product requires today the ability to install multiple instances on the same machine and our customers don't support XP or 2003. Other than updating the package code, product code, product name, upgrade code, and all componentID guids in the Component table is there anything else that makes the installation unique? Other than upgrade issues, what problems do you see with this?
A: Multiple instance support still existed in previous versions of the Windows Installer, you just couldn't use multiple instance transforms to accomplish it. Check out the Windows Installer documentation in MSDN, specifically the topic "Installing Multiple Instances of Products and Patches". If you want X number of instances, then you can author X number of .MSI's, each with its own package code, product code, and instance name. A unique upgrade code for each instance would give you the ability to upgrade particular instances. For non-file data, you should author component sets where the instance identifier is used to distinguish one from the other (like registry keys). The biggest limitation without the updated version of the Installer is that you can't create a multiple-product targeting patch if you don't want it to update all instances on the machine.
Host: Chris (Microsoft)
Q: Can you discuss whether MSI technology will ever work for deployment to Windows CE-based devices (.NET Compact Framework-built apps)?
A: Unfortunately, we can't comment on future plans for MSI in this forum. However I'll pass this request on to the planning team.
Host: Carolyn (Microsoft)
Q: (low-priority MSI question) Any method to force a reread of the *Sequence tables (say, after you added a temporary row to it at run-time)? The sequence tables appear to get queried before a sequence begins, and don't see new temp rows if added later.
A: No, there's no way to force the re-read of the *Sequence tables. Additionally, an added temporary row will not be seen. Perhaps you can elaborate on why you need to add temporary rows to the sequence table -- i.e. a particular action as opposed to perhaps authoring a condition based on a property that turns it on or off. It's more common to add temporary rows to some of the resource tables like RemoveFiles.
Host: Chris (Microsoft)
Q: (low-priority MSI question) Any way to ensure the environment is in place (e.g. for PATH additions) in msiexec's process before a custom action begins? (For NT-based OS's) We've run into some PATH problems with special registration steps we need to do.
A: Unfortunately, this is a very difficult problem which is inherent in the way that environment blocks are handled by Windows. When an environment variable is updated, a WM_SETTINGCHANGE message is sent to all windows on the system to indicate that the block has been updated. Only processes that actually listen and process this message will be able to refresh their environment block. For example, explorer processes this message, so if you start a new command prompt through explorer you will see your changes. However the service control manager does NOT listen for this message, so services started after the environment is updated will not see the update. This is why you often have to logoff and log on before your changes will be seen. MSI will pick up changes made before the install starts due to its client\server model, but it won't see changes made during the install.
Host: Stan (Microsoft)
Q: Or a better way, might be to package everything up as a zip or a cab file (whether part of the GAC or not), and then choose the Assembly(s) from within it (allows for easier deployment)
A: Do you mean using Assemblies with a Multilanguage User Interface? There is a topic from MSDN about it (https://msdn.microsoft.com/library/default.asp?url=/library/en-us/sbscs/setup/using_assemblies_with_a_multilanguage_user_interface.asp).
Moderator: Eric (Microsoft)
Thank you for joining us today to talk about Windows Installer Assembly Installation and Management.
If you would like further information on Windows Management technologies such as Windows Installer, please visit https://www.microsoft.com/windows2000/community/centers/management/default.asp
Moderator: Eric (Microsoft)
Thanks for joining us and we'll see you next time!
Please join us in the microsoft.public.platformsdk.msi newsgroup if you have any questions in the future.
Moderator: Eric (Microsoft)
There's also a good listing of other windows development newsgroups at https://msdn.microsoft.com/newsgroups as well
For further information on this topic please visit the following:
Newsgroups: microsoft.public.platformsdk.msi
MSI Transcripts: Read the archive of past MSI chats.
Website: Visit the Microsoft Windows Installer site.
Top of page