Fixing VLC’s MSI Package

VLC don’t shout about this too loudly, but they have offered an MSI package to download for some time from their FTP site:

https://download.videolan.org/pub/videolan/vlc/

However the packages suffer from a strange bug where any attempt to modify the tables or apply an MST (to delete the desktop shortcut for example) corrupts the database and breaks the installer. It turns out this is because the developers are building the MSI package on Linux with WiX running under WINE, which is listed as incompatible on WINE’s AppDB. There is an open ticket for this here:

https://trac.videolan.org/vlc/ticket/18985

I found a workaround by exporting the database tables to a new MSI and repacking the cab files (all of which can be done with several steps in InstEd Plus (if you deal with MSIs regularly you should buy it!). However I also now have a fully automated Powershell script to rebuild the MSI.

This script leverages Deployment Tools Foundation (DTF), a very useful .NET wrapper around the Windows Installer API that comes from the WiX Toolset. It also shoehorns in WiMakCab.vbs from the now defunct Windows Installer SDK to perform the cab file operations. However I’ve learnt a bit more about DTF whilst writing this and discovered I’ve re-inventing the wheel with some functions that are already covered in the API, so I aim to produce a 2.0 that handles the cabs natively!

Simply put your VLC MSI packages you want to rebuild into the Input folder and run Rebuild-Msi.ps1. Then you will be able to modify the package to tweak shortcuts, automatic updates, privacy settings, file associations, etc without it breaking on you.

Download the script below:

6 responses on “Fixing VLC’s MSI Package

  1. I have downloaded your script, installed Wix toolset, placed the VLC 3.0.6 msi in Input, run powershell as admin and fixed all execution policies, but get the following error. Any advice appreciated, or just In case it helps. It seems it’s not noticing Wixtools? Keep up the good work!

    Add-Type : Could not load file or assembly ‘file:///C:\VLC-MSI-Patcher-v1.0\VLC MSI Patcher v1.0\WixToolset.Dtf.WindowsInstaller.dll’ or
    one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
    At C:\VLC-MSI-Patcher-v1.0\VLC MSI Patcher v1.0\Rebuild-Msi.ps1:12 char:1
    + Add-Type -Path “$PSScriptRoot\WixToolset.Dtf.WindowsInstaller.dll”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand

    1. Dan Gough

      The dll is in the zip file, and the script just looks for it in the same folder as where it’s executing from. However I just tried to extract the downloaded zip and ran into the same problem. However, after restarting Powershell and re-extracting the files, everything went fine. Perhaps a previous Powershell session maintained a lock on the dll file?

      1. Eric

        Thank you, but no-go. Last thought; Have you imported any additional modules into powershell that might be needed? My workstation is running out of-the-box powershell 5.1. Do not waste your day here – I’ve been packing the exe just fine. It’s just annoying we cannot get a workable MSI. It’s one of those “so close yet so far” scenarios. Happy to check in a year for your 2.0!

        1. Chris

          Had the same thing here, the DLL needs to be unblocked because it has originated from an internet download. If you right-click the DLL file and look in properties there should be a checkbox to unblock it. The script then ran fine for me.

          Cheers for the script Dan!

  2. Hello,
    the script works perfect, thank you very much!!

  3. John

    This script works a treat, thanks. As has been mentioned you need to unblock the WixToolset.Dtf.WindowsInstaller.dll. To unblock you to tick the unblock check box!

Leave a Reply to Dan Gough Cancel reply