lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

Add a Windows msi installer

Open feschber opened this issue 9 months ago • 8 comments

feschber avatar Mar 17 '25 01:03 feschber

Todos

  • [x] include the gtk dlls
  • [x] check if any other dlls are requried
  • [ ] dont bundle msvc runtime dlls
  • [ ] fix multiple installs possible
  • [ ] update CI

feschber avatar Mar 17 '25 01:03 feschber

Do Rust binaries depend on MSVC? Just curious. I'm pretty sure Rust uses MSVC Toolchain by default.

If it does, you may want to add an MSVC dependency to the WiX config. Here's how I did it recently: https://github.com/deskflow/deskflow/blob/0e3cee628751ed7be70f065e182ea9c7614f2378/deploy/windows/wix-patch.xml.in

You can also use WiX burn to bundle the MSVC redist MSI with your MSI to create a .exe that installs both (this is the recommended approach since Microsoft discourages DLL side loading and has deprecated merge modules which were historically used to install the MSVC deps).

nbolton avatar Mar 17 '25 14:03 nbolton

Do Rust binaries depend on MSVC? Just curious. I'm pretty sure Rust uses MSVC Toolchain by default.

If it does, you may want to add an MSVC dependency to the WiX config. Here's how I did it recently: https://github.com/deskflow/deskflow/blob/0e3cee628751ed7be70f065e182ea9c7614f2378/deploy/windows/wix-patch.xml.in

You can also use WiX burn to bundle the MSVC redist MSI with your MSI to create a .exe that installs both (this is the recommended approach since Microsoft discourages DLL side loading and has deprecated merge modules which were historically used to install the MSVC deps).

Yes, it seems to require C:\windows\system32\VCRUNTIME140.dll and C:\windows\system32\VCRUNTIME140_1.dll. I just copied those from C:\windows\system32 for the time being to get it working but it definitely seemed very hacky.

I guess you are refering to https://learn.microsoft.com/en-us/cpp/windows/redistributing-components-by-using-merge-modules?view=msvc-160 / https://learn.microsoft.com/en-us/cpp/windows/deployment-in-visual-cpp?view=msvc-160#central-deployment?

Is there any proper documentation on how to do this? I found the wix documentation to be somewhat incomplete.

feschber avatar Mar 17 '25 18:03 feschber

Is there any proper documentation on how to do this?

Unfortunately, I did not, just had to muddle my way through it, sadly. For WiX, docs.firegiant.com seems to be the best but Microsoft docs for creating MSI files seems hard to discover. I can't remember where I read about side-loading and merge modules being discouraged and why... but this seems firmly ingrained in my memory. Microsoft really wants us to redistribute their MSI redistributable... I think it's easier for them to keep up to date and patch security vulnerabilities.

nbolton avatar Mar 18 '25 12:03 nbolton

Is there any proper documentation on how to do this?

Unfortunately, I did not, just had to muddle my way through it, sadly. For WiX, docs.firegiant.com seems to be the best but Microsoft docs for creating MSI files seems hard to discover. I can't remember where I read about side-loading and merge modules being discouraged and why... but this seems firmly ingrained in my memory. Microsoft really wants us to redistribute their MSI redistributable... I think it's easier for them to keep up to date and patch security vulnerabilities.

Thank you! It seems reasonable for various reasons to not have every application ship their own copy of the dlls. I'm going to check out burn as you mentioned or maybe just tell people to install the vcruntime on their own.

feschber avatar Mar 18 '25 13:03 feschber

just tell people to install the vcruntime on their own

That's what we're doing with Deskflow since there's no burn support for CPack-WiX right now.

For Synergy we configure full-blown WiX manually like you're doing, and we use a naughty merge module (we were using them since before Microsoft deprecated them), but we plan to move to burn soon and bundle the MSVC redist MSI and be good little Windows developers.

nbolton avatar Mar 19 '25 11:03 nbolton

Crazy how difficult this stuff is on windows compared to Linux ...

feschber avatar Mar 22 '25 12:03 feschber

Crazy how difficult this stuff is on windows compared to Linux ...

I recommend taking a look at Tauri's codebase, they have .MSI packaging working (with extra customization steps that you could discard), linking rust code properly, and working through cross compilation.

PedroHLC avatar May 18 '25 14:05 PedroHLC