Search code examples
c#winformswindows-installer

Retrieve Assembly Version of an Application stored in an msi


I cant work out how I would tell from the installer msi, what AssemblyVersion of the application it will install is.

I would like to make a request every few hours to a network location, check the setup.msi to detect a change and then prompt the user to update.

Could I tether the two AssemblyVersions, so as I increment the application it increments the Installers? That way I could check the installer Version?

Or, is there a way to tell from the msi what application version it will install?

Or should I just go about this in a different way, say placing a text file with the revision number on the network share? (not preferred)

N.B. I have used SetupProject to create my installer.


Solution

  • At the risk of repeating some of Michael U's answer, I'll point out that nobody does that in a Windows Installer environment. When any of the files in a Visual Studio MSI build need deploying to clients, the only solution with VS setup projects is a major upgrade, where you increment the version of the setup project (accept the changes), set RemovePreviousVersions to true, and you must increment the file versions of the files that need updating. You don't need to change AssemblyVersion to do this, but you do need to increment AssemblyFileversion. This should help:

    https://www.red-gate.com/simple-talk/dotnet/visual-studio/updates-to-setup-projects/

    but it's missing the part about updating file versions.

    In general, the update mechanism is fairly straightforward. Major upgrades are based on UpgradeCode, so your application just needs to do a web service call somewhere passing the current ProductVersion and UpgradeCode, and then you need to download any version that is higher than your current ProductVersion, then install it. That's the general idea that works for multiple products on a client system, and there are simpler solutions if you know there is only one product.