<< SmartGit Milestone 6 build 3 | Home | SmartCVS 7.1 beta 3 >>

MSI-Installer does not overwrite files reliable

WiX-generated MSI-installer on Windows does not update a previously version reliable

Some users reported that installing a new version of our SVN client SmartSVN over a previous version did not work correctly. Starting SmartSVN still showed the old version, although the installation process went well without any error message and the "Programs and Features" item of the Windows Control Panel showed the new installed version.

What has gone wrong? The most important information came from one user who told that he had copied the new .jar files from the SmartSVN intermediate build over the old SmartSVN installation, before installing the new SmartSVN version.

Unfortunately, I first could not reproduce the problem, because I used Altap Salamander, a classical two-pane file manager which I can recommend, to copy the files from the intermediate build over the old installation. But — thanks to the helpful tips in the WiX mailing list — I found out, that Altap Salamander copies files in a different way than the Windows Explorer. While the Explorer only changes the file's modification time, Altap Salamander also updates the file's creation time, an important detail when working with MSI.

According to the File Versioning Rules of the MSI SDK, the .jar files will be treated by MSI as user data and hence the creation and modification times define whether a file will be overwritten by an update: if the modification time is newer than the creation time, MSI will not overwrite the file when updating.

Originally, our WiX-script for one component/file looked like this

<Component Id="componentSmartsvnJar" Guid="...">
  <File Id="smartsvn.jar" Name="smartsvn.jar" Source="..." />
</Component>

I had to add a RemoveFile element to the component to ensure that the previously existing file always would be removed before installing the new file:

<Component Id="componentSmartsvnJar" Guid="...">
  <RemoveFile Id="smartsvn.jar" Name="smartsvn.jar" On="both"/>
  <File Id="smartsvn.jar" Name="smartsvn.jar" Source="..." />
</Component>
Tags : ,
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!



Add a comment Send a TrackBack