Search code examples
winformspackagingmsix

How do I create an installer application in WinForms?


Not to be confused by questions like "How do I create an installer for a WinForms app?". I want to create my own layout of the installer in WinForms. I want to create my own installer, using WinForms, including all of the installers' functionalities such as adding registry keys, certificate, user account choice ("Me" or "All users on this computer"). Of course, I assume that reinventing the wheel is possible, but comes with a lot of complications.

That's why items like these exist:

These "templates" allow you to add all functionality of an installer, including the files you wish you pack, "with the push of a button". But they already have their own UI and I do not wish to poke deeper in them to customize the UI. I want to use WinForms to create the UI, options such as file destination(s), optional files, progress bar(s), rollbacks, referrals to websites, ads, etc.

I do not want to create a typical WinForms project to mimic an installer, by simply having the files packed into its Resources or an external file to read/parse from, then copy them where they have to go. I would prefer using the functionalities from MSIX for instance and design my own UI. How do I accomplish this? Can I implement the MSIX Packaging functionality into a WinForm project then use it to calculate the progress, certificate validation, rollbacks and other mandatory behaviors of a Windows installer?


Solution

  • Would highly recommend checking out Wix#.

    It has a Winforms-style designer and you can add custom actions too as far as I know.

    Or if the basics work for you, you can just make a custom dialog using XML in wix. This tutorial can help you get into the basics of it: Add-in express