cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kriz_82
Level 5

Component Key File

Hi,
I have few basic questions

1. Could someone clarify what is the reason why component file should be created?

3. In installshield document (IS_Tip_Working-With-MSI-Features-Components.pdf) it is written
"For the most effective file transfer, a component should contain at most one executable or DLL—ideally, a versioned file—and this file should be marked as the key file of its component."

What is point in it? (in the context that during the update each file within the component is evaluated independently from key file evaluation results?)

3.MSDN says:
"Because the installer only installs entire components, if the installed key file is replaced then, all of the component's files are replaced."

Does it mean that if key file is not changed files within components are not change (checked for change) neither?

When i when I am creating a new version of a product (ProductVersion is incremented) each file is evaluated one by one to determine whether it should override/patch existing files. If the key file was not change but other files within given component are change they are correctly updated on target machine.

Regards!
Labels (1)
0 Kudos
7 Replies
Ajay_Ladsaria
Level 7

Hi,

Windows Installer makes a determination on whether to install a component or not based on its keyfile. Then if it decided that the component will be installed, then it individually checks each file in the component to see if it will be installed or not.

If a component has a versioned keyfile, then MSI will mark the component to be installed if the version of the file is equal or greater than an existing file version. If a component has no keyfile or an unversioned keyfile, then the component will always be flagged to be installed.

Later on in the InstallFiles action, MSI will follow its normal file versioning rules to decide whether to install each file in components marked to be installed.

File Versioning Rules
http://msdn.microsoft.com/en-us/library/aa368599(VS.85).aspx

-Ajay
0 Kudos
kriz_82
Level 5

Thank you, the link was very useful.

What about the following sentense:
"For the most effective file transfer, a component should contain at most one executable or DLL—ideally, a versioned file—and this file should be marked as the key file of its component."

Let say my component contains 10 versioned files and one of them is keyfile,
I would like to produce an update and replace one file, does my patch have to contain all files from the component or it might be just the one that was modified?

Regards!
0 Kudos
kriz_82
Level 5

Hi,

For testing purposes I created an installer (productVersion 1.0.0) that contains one feature, one component and 10 versioned files with key file inside. It is about 10MB

Later I created a new version (1.0.1). In the new version i replaced key file with new version. Then I created a patch. The only difference was the key file (5kB) and the patch size was 10 kB. It means that the patch does not contain all the files within the component but only delta, am I right?

With that patch i was able to successfully patch the version V1.0.0 to V1.0.1.
0 Kudos
Ajay_Ladsaria
Level 7

You are correct that it is possible to have 10 versioned files in one component and create a patch that only updates one of these files and only contains the binary delta for this one file.

However, including multiple versioned files in one component is against best practices. It may make it difficult for you to update some of the versioned keyfiles without also updating the keyfile.

Basically putting the versioned files in separate components will help you avoid headaches in the future.

Also, you can't take full advantage of the Windows Installer resiliency or Auto-Repair functionality which can trigger a repair if the keyfile has been deleted.

-Ajay
0 Kudos
kriz_82
Level 5

Ok, thanks

Regards!
0 Kudos
kenzo22
Level 6

Hello Ajay,
You said "If a component has no keyfile or an unversioned keyfile, then the component will always be flagged to be installed". However, in my case, I have a component which only includes several unversioned icons, no key file.
When I launch repair, I found the following information in the verbose log "Iconcomponent; Installed: Local; Request: Null; Action: Null", but actually I want this component to be reinstalled, can you give me some suggestions on how to achieve this, thanks in advance.:)
0 Kudos
Ajay_Ladsaria
Level 7

Hi,

I created a new simple MSI file to test the scenario you outlined. I included one unversioned file in one component and built an uncompressed MSI package. Then I installed it on Windows 7 and then I immediately repaired it from Control Panel - Programs - Programs and Features menu.

I checked the MSI log and found the following in it:
MSI (s) (A8:C0) [14:13:57:237]: Command Line: REINSTALL=ALL REINSTALLMODE=ocmusv
...

MSI (s) (A8:C0) [14:13:59:289]: Feature: NewFeature1; Installed: Local; Request: Reinstall; Action: Reinstall
MSI (s) (A8:C0) [14:13:59:289]: Component: NewComponent1; Installed: Local; Request: Local; Action: Local
...

MSI (s) (A8:C0) [14:14:00:576]: Executing op: FileCopy(SourceName=APPVED~1.TXT|appvEditorNotes.txt,SourceCabKey=appveditornotes.txt,DestName=appvEditorNotes.txt,Attributes=8192,FileSize=2217,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=126091264,HashOptions=0,HashPart1=841263550,HashPart2=702072288,HashPart3=-777506606,HashPart4=997095868,,)
MSI (s) (A8:C0) [14:14:00:578]: File: C:\Program Files (x86)\My Company Name\My Product Name\appvEditorNotes.txt; Won't Overwrite; Won't patch; Existing file is unversioned and unmodified - hash matches source file

The first part gives the REINSTALLMODE setting used by the OS. Please take a look at the documentation for this property if you are not familiar with it.

The second part outlines which components and features will install. Note that in my example the only component and feature in my sample MSI package were marked to be installed.

The third part shows where MSI actually installs each file in each component marked to be installed. Note that in this case since the file was unversioned and the hash matched the source, there was no need to reinstall it.

You may want to set-up a sample MSI package as I did to see this behavior. Then check to see how your reproduction steps vary from those that I used.

-Ajay
0 Kudos