다음을 통해 공유


Windows Installer - Patches and Upgrades

Posted January 22, 2003

Chat Date: January 8, 2003

Chat Participants:

  • Chris Gouge, Software Design Engineer
  • Carolyn Napier, Software Design Engineer
  • Mark Lathrope, Technical Lead

Windows Installer - Patches and Upgrades

January 8, 2003

Host MS_Eric_S
Welcome to today's Chat. Our topic is Windows Installer - Patches and Upgrades. We have a great line-up of experts ready to tackle your questions.

Host MS_Eric_S
The Lower Room is where you can enter questions for our experts today. We will read them and select questions to answer. The questions and answers will be posted in this room, the Top Room.

Host MS_Eric_S
Please feel free to begin posting your questions in the room below. Please begin your questions with a Q: this will help us quickly identify the questions.

Host MS_Eric_S
Let's introduce our experts (aka Hosts) for today.

Host Guest_Chris_MS
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 Guest_Carolyn_MS
Hello and Happy New Year! I'm Carolyn, a developer on the Windows Installer team. I have been on the Windows Installer team for a little over three years and specialize in patching and upgrades, digital signatures, and overall architecture.

Host Guest_Mark_MS
Hello. My name is Mark Lathrope, I am the Technical Lead on the Windows Installer support team in Developer Support.

Host MS_Eric_S
Welcome everyone, let's get started!

Host Guest_Carolyn_MS
Q: Can I create an msp which will update both the msi's at version 5.0 and 5.2..

Host Guest_Carolyn_MS
A: Yes, a single patch can be created that updates both versions of the product. Basically you'll have a single update image and two target images. In the TargetImages table of your patch creation properties file (PCP), have an entry for each target image. When the patch is generated, it will have two sets of transforms. The appropriate set will be chosen based upon the version of the product on the machine.

Host Guest_Chris_MS
Q: QUESTION FOR PRESENTERS - It looks to me like ORCA can NOT open a .MSP file is this correct?

Host Guest_Chris_MS
A: Orca can not open a patch file directly, because a patch file needs a target database before the changes it contains make sense. However once you have an MSI file open, you can open a patch file using the Transform\View Patch... command. You can

Host Guest_Chris_MS
even apply multiple patches one right after the other to see the cumulative effect.

Host Guest_Mark_MS
Q: ok, i'll go look there too. does ne1 know how to distribute a VB app sothat it can interface with excel files on a target machine that does not have Excel already installed? how do u include the excel dll's in an app? what files need to be included?

Host Guest_Mark_MS
A: Excel doesn't really have a merge module of the product's DLL files that you can include in your setup project. I would suggest taking a look at the Microsoft Office Developer Edition on the Office web site to see if this is possible, or to find out what process you need to follow to accomplish this.

Host Guest_Carolyn_MS
Q: Is there planned support for a Plugin or Upgrade for AD to allow patches to be deployed through Group Policies?

Host Guest_Carolyn_MS
A: Future plans for Microsoft Software Update Services are considering having the ability to deploy patches to client machines. The current level of support for Group Policy requires the use of patching of administrative images.

Host Guest_Carolyn_MS
Q: Is there any overriding reason to deliver transforms if most of my changes are updated files (within the cab file) which necessitates a patch?

Host Guest_Carolyn_MS
A: Actually you can't deliver transforms in that method. Transforms can only be applied at first time installation. For any update to the product after that in which you want to use a compressed diff format, you need to use a patch. Now what may be confusing is the fact that the inside, a patch consists of at least one set of transforms and a cabinet file. The set of transforms contains two transforms, one for database authoring changes and the other for the patch specific content.

Host Guest_Chris_MS
Q: I have just recently started using MSI. When installing on top of an existing installation, MIS offers to install or remove, but not to upgrade. Reinstalling doesn?t update files. How to I add an upgrade option or force install to replace files?

Host Guest_Chris_MS
A: MSI has several different types of upgrades that you could utilize depending on your requirements: Small, Minor, and Major updates. Small updates are usuall QFE-sized changes, minor updates are often analgous to service packs, and major upgrades are large upgrades (version to version). For major upgrades, you can define upgrade relationships between products so that they automatically replace earlier versions. Minor and Small updates are usually distributed as patches that apply to the existing product and update the current install. Please see the MSI documentation for more information.

Host Guest_Chris_MS
Q: Is it true that the processing of the upgrade table only looks at the first 3 fields of the 4-part version identifier? Is the 4th field ignored? Are there plans to change this?

Host Guest_Chris_MS
A: Yes, this is correct. Only the first 3 fields of the version are used. There are no plans to change this behavior.

Host Guest_Mark_MS
Q: I have two questions.. 1. Is it possible to update custom actions in the msi using a patch..2. Is it possible to create windows user in an msp/msi without writing custom actions.

Host Guest_Mark_MS
A: You can include custom actions in your patch file, but in order to create user acconts you would have to use a custom action, no built in support for this. There is an example in the SDK of how to accomplish this.

Host Guest_Carolyn_MS
Q: How do I uninstall a patch

Host Guest_Carolyn_MS
A: Unfortunately the current version of the Windows Installer does not offer native support for uninstallation of a patch. Your current options are to completely uninstall the product (and then install again plus re-apply other patches) or to generate what is termed as an "anti-patch". The anti-patch would either be a reverse patch where the target and update images are switched in the PCP file. You would need to obsolete the previous patch and alter the version numbers or use a REINSTALLMODE of 'a' which is dangerous. The ability to uninstall a patch is under consideration in a future release.

Host Guest_Chris_MS
Q: when creating a patch between two MSIs, if two files of the same name and destination but different versions are in different components in each MSI,is it still possible to create a patch for the file?

Host Guest_Chris_MS
A: It is possible to create a patch in this scenario, however because this violates the rules for components (as described in the MSI help file), you may end up with some incorrect behavior. It is not a recommended practice to move resources from one component to another.

Host Guest_Mark_MS
Q: I have looked for some good books on MSI but haven't found much. Can you reccommend a few titles?

Host Guest_Mark_MS
A: Take a look at the https://www.installsite.org web site, it has links that point to all the books related to the Windows Installer.

Host Guest_Carolyn_MS
Q: I am rather new to distributing applications and would like to know how to create a patch for an app. Is the process different from a normal fresh install?

Host Guest_Carolyn_MS
A: Creating a patch is slight different from normal installations in both the creation process and the application process. To generate a patch you need to have two uncompressed images, one called the target and the other called the update. You then use a patch tool to create a MSP which contains the delta between the two images. You can find more information on creating a patch in the Installer documentation in MSDN

Host Guest_Carolyn_MS
https://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/patching_and_upgrades.asp. The patch creation tools can be found in the Windows Installer SDK https://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm.

Host Guest_Chris_MS
Q: I'm installing using elevated privileges with a restricted user logged in. Redists (e.g. mdac_typ.exe) are copied to the target system and then run using custom actions in deferred system context. Some redists require a reboot to swap (then register some system files. After the reboot, the restricted user logs back in and then a series of errors are generated, I'm guessing because the restricted user doesn't have the rights to swap or register these files. How do you get round this?

Host Guest_Chris_MS
A: If the post-reboot operations are generated by the EXE and not by MSI, you should really talk to the owner of the EXE. Custom Actions (such as redists) are really "black boxes" to MSI, we unfortunately have no control over what they try to do.

Host Guest_Carolyn_MS
Q: MS includes repair information in it's Office2000 patches so that Windows Installer auto-repairs the Office features that were "patched". Is this normal functionality that we can all use when creating patches or is it something special that MS does?

Host Guest_Carolyn_MS
A: Office patches use type 51 custom actions to automatically set the REINSTALL and REINSTALLMODE properties to the appropriate values. The trick is to make sure the actions are conditioned appropriately. You can do this yourself by authoring the

Host Guest_Carolyn_MS
A: TargetImages table to use an alternate MsiPath for a package that has those custom actions present. You'll also want to make sure that you author unique source properties in the MediaSrcPropName column of the ImageFamiles table and condition the actions so that it only runs when the patch that is applied matches the MediaSrcProp value.

Host MS_Eric_S
Hello. For those just joining the chat - Our topic is Windows Installer - Patches and Upgrades. We welcome your questions. Please begin them with a capital

Q: and post them in the lower room. We will post answers in this room, the top room.

Host Guest_Chris_MS
Q: In the Windows Installer 2.0 doc, it says that 2.0 is needed to install .NET assemblies? Why is this, and what specifically is it doing besides simply copying the assemblies and manifests into the GAC or private directories?

Host Guest_Chris_MS
A: MSI 2.0 is required to install .NET assemblies because .NET assemblies did not exist when earlier versions of MSI were released. MSI integrates with .NET assemblies closely, providing many of the same benefits as for other files. For example, advertisement, fault-in, auto-repair, and so forth.

Host Guest_Mark_MS
Q: Can you patch a file that is not a key to its component without updating the component key?

Host Guest_Mark_MS
A: Yes. As long as the file version information is updated and you set the state Feature it belongs to to be reinstalled while applying the patch, the normal file versioning rules will apply and update the file.

Host Guest_Carolyn_MS
Q: is creation of patch dependent on win installer version. Can i have a patch that applies to 2 msi's supporting different installer service versions( eg v 1.2 and v 2.0)

Host Guest_Carolyn_MS
A: It depends on exactly what you mean. Certain versions of the Installer only support certain patches. For example, some changes were made to the patch technology to optimize patch size for large files. If you make use of this option, then you can

Host Guest_Carolyn_MS
A: only apply the patch with MSI 1.2 or greater. You can't generate a single patch that would target different patch engines. However, you should be able to generate one patch for 2 MSI's that have different schema versions. The important part is that you must be able to distinguish between the two MSI's (different product version, product code, etc.).

Host Guest_Chris_MS
Q: I need the InstallDir and the SourceDir in a Deferred Custom Action... How do I get them?

Host Guest_Chris_MS
A: Data can be passed to a deferred custom action via the CustomActionData property (set by defining a property with the same name as the action). By using a type 51 action, you can set the data property to the value of another property (or properties) to access it via a deferred custom action.

Host Guest_Carolyn_MS
Q: When do you need the source of the installation you want to patch? Only for byte-level patches?

Host Guest_Carolyn_MS
A: In most cases Windows Installer version 2.0 significantly reduces the times when the original source is necessary. This is most commonly seen with byte-level patches when the file on the machine cannot be patched by the byte-level patch in the MSP.

Host Guest_Carolyn_MS
A: A full list of cases where the source is required can be found in the Windows Installer FAQ at https://www.microsoft.com/windows2000/community/centers/management/msi_faq.asp

Host Guest_Mark_MS
Q: How do u elevate privilages in MSI?

Host Guest_Mark_MS
A: You can elevate priviledges for MSI based installations in 2 main ways. 1) Log on as with Administrator permissions 2) Assign or Publish the applicaiton from Active Directory.

Host Guest_Carolyn_MS
Q: How to un-install a patch without uninstalling the product

Host Guest_Carolyn_MS
A: This was addressed earlier in the chat. The first option and only best option is to uninstall the product. The second option is to create a sort of anti-patch or reverse patch that obsoletes the patch. If you wanted the files to return to a

Host Guest_Carolyn_MS
A: previous state, then you'll need to generate a patch where the target and update images are reversed and artificially bump the file versions. This is because of the MSI file versioning rules. Alternatively you could apply the patch with a REINSTALLMODE that includes 'a' although this is dangerous. At this time, this is really the only method. Native support for patch uninstall is under consideration in a future version of the Installer.

Host Guest_Chris_MS
Q: How can I use a property to set the DefaultDir column in the directory table?

Host Guest_Chris_MS
A: This is not possible, the DefaultDir column is not a formatted-text column. However the Target directory for a particular row can be modified by setting a property of the same name as the directory row (via any method). Source and Target directories for features and components can also be modified during an install via the MSI API set.

Host Guest_Carolyn_MS
Q: I'd like to release a single license file which isn't removed during uninstallation, but is also not replaced if the file already exists, is this possible?

Host Guest_Carolyn_MS
A: You should be able to accomplish this by marking the component as permanent (therefore it won't be removed) and never overwrite (which means if it exists it won't be replaced). Consult the Windows Installer documentation on the Component table for more information.

Host Guest_Chris_MS
Q: Joe: to install elevated: HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated=DWORD:1

Host Guest_Chris_MS
A: Use of the AlwaysInstallElevated policy is STRONGLY discouraged. It is a security risk for the target machine. Once this policy has been set, the machine's security is permanently questionable, since anybody could have installed any "backdoor" software or other bad things on the machine while the policy was set.

Host Guest_Mark_MS
Q: Can I use the same file in two separate components without putting it twice in the package?

Host Guest_Mark_MS
A: You can do this, but it's definitely not advisable. See the help topic in the Platform SDK (which includes the MSI docs) called "What happens if the component rules are broken?" for more information on this strategy.

Host Guest_Carolyn_MS
Q: During initial install I add some INI settings to an INI file. These are set as DO NOT OVERWRITE. I do an Upgade and they aren't Overwritten as promised, but if the Upgrade Rollsback, they are uninstalled. How to prevent this?

Host Guest_Carolyn_MS
A: That sounds like an issue that the Windows Installer team should investigate. Thanks for reporting this.

Host Guest_Carolyn_MS
A: You might have to use a custom action to do the settings to work around the issue.

Host Guest_Chris_MS
Q: RE: deferred custom Action.. I did as you said and set the data of the property to: [INSTALLDIR]---[SourceDir]. I get the install dir but not the source dir. Why?

Host Guest_Chris_MS
A: It is impossible to accurrately diagnose specific problems in this forum, however I would verify that the SourceDir property has been set (i.e. that the source has been resolved) at the time that your CustomActionData property is set.

Host Guest_Carolyn_MS
Q: I have a text file that I update from my app. Its component is in the same feature as a DLL I need to update. When I try to install my patch I get a request for source..the log says it is because of this text file. Is there a way to prevent this?

Host Guest_Carolyn_MS
A: Yes, if you have Windows Installer version 2.0 or greater. You need to add an entry for the text file in the MsiFileHash table. This will prevent the unnecessary copy of the unversioned file. The Windows Installer SDK tool msifiler.exe can auto-populate the file hash entries for unversioned files for you.

Host Guest_Chris_MS
Q: So what is the MS RECOMMENDED method to allow ANY USER to install an app that may install to Windows or system directory without MSI complaining that admin rights r required?

Host Guest_Chris_MS
A: If MSI allowed an application install to simply elevate itself regardless of the user's permissions, this would be a huge security hole. MSI's security model is that applications can only install with elevated privileges when the administrator has taken an active step to approve the product. Currently, this is done by advertising the app using administrator credentials. This advertisment can be done directly via the command line or via some deployment technology (SMS, Intellimirror, or a similar solution from MS or another vendor.)

Host Guest_Chris_MS
A: Also, some applications explicitly are authored to require administrative privileges (by using the AdminUser property or some other method) and will not allow restricted rights users to install even if MSI is OK with the product install.

Host Guest_Carolyn_MS
Q: What information goes in the languages property of the summary info stream? A)The langid of the untransformed database. B) The langids of the unxfmed db and all available xfms? C) Something else? What is the right way to localize a db using xfms?

Host Guest_Carolyn_MS
A: For an installation package, the only supported method is for a single language to be in the summary information stream. That language is the base language of the package and should match the ProductLanguage property value. If you wish to use language transforms, you should use a bootstrap executable that will apply the appropriate language transform.

Host Guest_Mark_MS
Q: I have exported an msi from the Component services console.. I need to add two dlls to this msi as a patch. I am unable to generate a patch for this.. Is there a limitation to the msi created via Components Services.

Host Guest_Mark_MS
A: If you cannot generate a patch for the components services generated .msi packages, you could accomplish this by uninstalling the product and reinstalling with a Transform. I'm not aware of any specific limitations on these packages so you might need

Host Guest_Mark_MS
Q: Mark_MS; The target of the two same files would be different: In my case, I have to install .net assemblies in the GAC, but also put in them in a separate directory. This still means I have to include the assembly twice in the package?

Host Guest_Mark_MS
A: You should be able to use the DuplicateFile table to accomplish this from a single file.

Host Guest_Carolyn_MS
Q: Carolyn_MS, the file hash is populated. I hink it is for this reason that the file truies to update itself, becaus ehte hash in the MSI does not match that of the machine. Why try to update the file at all?

Host Guest_Carolyn_MS
A: If the creation and modified dates for the unversioned file are the same and the hash of the file on disk is different from the hash stored in the file hash table, then the Installer will update the file. This is documented in the file versioning

Host Guest_Carolyn_MS
A: rules topic in the MSDN documentation. If you didn't update the file in your update package, then the file hash in the MsiFileHash table should match the file on disk. If the file hash is truly being used, the FileCopy opcode logging will tell you that the hashes are different and it is updating the file. What might be happening in your case is that the file hash isn't getting used. Check the FileCopy opcode to see if there are hash fields.

Host Guest_Carolyn_MS
Q: Follow-on for Carolyn: If a bootstrapper and multiple xfms are used, should the Summary Info Stream Lang prop still contain the base language, 0, or all available?

Host Guest_Carolyn_MS
A: The package should still contain the base language. Your bootstrapper should be performing the actual installation and pass in TRANSFORMS=langid.mst on the command line to apply the language transform. That transform should then update the

Host Guest_Carolyn_MS
A: ProductLanguage property value in the Property table and most likely change the product code if what you are providing is different languaged versions of your product.

Host Guest_Chris_MS
Q: Is Microsoft planning to release a package similar to Install shield in the near future..or will MS continue to recommend usage of InstallShield.

Host Guest_Chris_MS
A: Currently, Microsoft releases the Visual Studio Installer as part of the Visual Studio product. Beyond that, Microsoft partners with other companies (such as Installshield and Wise) for authoring tools. There are also other tools available on the we by other vendors. MS does not recommend any specific authoring tool over any other tool.

Host Guest_Carolyn_MS
Q: Carolyn_MS, there are hash fields. I don't have the log handy, but it said something to the effect that the hashes were different. They ARE becuase my App updates this text file, thus changing the hash.

Host Guest_Carolyn_MS
A: I can't say for sure what is happening because I don't have access to the log files or patch and packages. Verify that your patch actually includes the updated unversioned file. Most likely if this is a text file, it is included as a whole file in

Host Guest_Carolyn_MS
A: the patch cabinet rather than a byte-level patch. That means that the Installer should be able to get the file from the patch cabinet rather than the source location. Unfortunately, that's the best I can at this point with the information I have.

Host Guest_Chris_MS
Q: Patches contain unique patch IDs and also contain a list of patch IDs the patch will replace, however you can still install an old patch over the top of a new patch. Shouldn't Windows Installer prevent that?

Host Guest_Chris_MS
A: Better support for patch obsolescence and supersedence is something that we are looking at for the next version. If the updates are minor updates which change the ProductVersion, you can use the validation flags of the transforms to ensure that the older patch doesn't apply after the newer patches are applied.

Host Guest_Carolyn_MS
Q: Carolyn_MS: The patch does NOT include the unversioned file. I don't want it updated it all, I want my DLL updated. If I apply the patch in ORCA, my text file is unaltered...but when I run the patch it still tries to install it.

Host Guest_Carolyn_MS
A: If the App updates the text file then the files creation and modification dates should be different. The Installer should treat that as user data and hence not update the file. Of course, this behavior is controlled by the REINSTALLMODE property so if you are using a setting other than 'omus' then you may be causing a force update of the file. This would most certainly happen with the usage of 'amus' which you should avoid.

Host MS_Eric_S
Thanks for joining us today and thanks for the questions. It's time for us to go now. You'll be able to find the transcript of this chat soon on https://msdn.microsoft.com/chats/recent.asp. Please see the chats schedule for upcoming topics.

Host Guest_Chris_MS
As a reminder, our next chat will be February 4th, 2003 at 11:00 A.M. Pacific time. There is no specific topic, all MSI questions are welcome. In February, the MSI team will also be

Hosting an informal bonus chat immediately following the regular chat, discussing the future of Windows Installer (feedback and suggestions).

Host MS_Eric_S
If we didn't get a chance to answer your question, you might try asking in the Windows Installer newsgroup at news://msnews.microsoft.com/microsoft.public.platformsdk.msi

Host MS_Eric_S
Or see https://msdn.microsoft.com/newsgroups for a complete list of MS developer newsgroups.

Top of pageTop of page