briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Create Windows executable instead of MSI

Open N8n5h opened this issue 4 years ago • 5 comments

Hi, I have two questions: Is it possible to create a self-contained Windows executable file instead of an installable version? Basically I'm looking for something similar to how the packaging is done already for linux. If it isn't at the moment, will it ever be possible? Thanks.

N8n5h avatar Jul 21 '20 14:07 N8n5h

@N8n5h The short answer is we'd like to, but it depends on what the platform makes possible.

The approach used by Linux relies on some OS-level features - an AppImage is effectively a mounted disk image, and there's no real analog of that on Windows (that I'm aware of, anyway).

Tools like pyinstaller are able to create "single exe" apps - but they do this by packaging all the Python code as data, and then installing an importer hook to allow loading modules from somewhere other than a site_packages folder on disk. This can work... right up until it doesn't. There's a surprising amount of code out in the world that doesn't play nice with this approach.

So, as a concept, we'd love to support it. The question is how.

freakboy3742 avatar Jul 21 '20 22:07 freakboy3742

Ok, thanks for the explanation!

So, maybe something that could be done (if it isn't there already) is to allow the installer to be as close as the experience with an exe can get?, e.g.

  • Autostart the program when the installation is done
  • Silent installation
  • Install to the temporary folder
  • Install once and the next time just launch the program when trying to open the installer
  • Exe installer instead of .MSI

are any of those possible or the toolset/briefcase may not allow them?

N8n5h avatar Jul 22 '20 00:07 N8n5h

Briefcase, at it's core, is a templating project. You give it a project that defines requirements, and it rolls out those requirements into a template project, installs dependencies, and runs whatever packaging/compilation is required. If you can define a template for the output format you want, you can make Briefcase generate it.

If invoking WiX will get you the output you want, then you can use the existing MSI backend and a custom template definition; but if you need to use a tool other than WiX, you can define your own backend and plug into briefcase.

So - can any of those features be provided? It depends on whether you can (a) configure WiX to support them, or (b) find some other project layout/tooling combination that will allow those features. If you can roll out the required layout manually for a single project, then you can modify Briefcase to generate that layout for the general case.

freakboy3742 avatar Jul 22 '20 03:07 freakboy3742

Ok, thanks for the explanation!

So, maybe something that could be done (if it isn't there already) is to allow the installer to be as close as the experience with an exe can get?, e.g.

* Autostart the program when the installation is done

* Silent installation

* Install to the temporary folder

* Install once and the next time just launch the program when trying to open the installer

* Exe installer instead of .MSI

are any of those possible or the toolset/briefcase may not allow them?

【Guess if this scheme works, the individual exe file should run very slowly.】

zhorsex avatar Jan 06 '21 14:01 zhorsex

This feature would be awesome.

geeede avatar Mar 12 '22 20:03 geeede

May I add to this discussion? I would be happy to distribute my program as a "one-folder" version on Windows. It should also be part of another software, so an installer would be annoying. So is it possible, after building, to distribute the folder containing the binaries? Or does 'package' do some additional magic which is required for running the program, e.g. writing an .exe ?

MarkusPiotrowski avatar Nov 17 '22 17:11 MarkusPiotrowski

@MarkusPiotrowski Packaging on Windows doesn't do anything to the app itself - it only builds the MSI. All the steps setting icons and app metadata are handled in the build step. Ultimately, the package step is not much more than copying the contents of the src folder to a "system" location.

Based on what you're describing of your use case, I suspect you could just use the src folder as-is, copying it into your other software.

One related option here would be to add a zip packaging format option in addition to msi. With a relatively small number of changes to Briefcase and the Windows templates, it would be possible to have Briefcase output a .zip file that contains the app content. In that way, briefcase package -p zip would output a zip file that would be just as relocatable as the MSI.

freakboy3742 avatar Nov 17 '22 22:11 freakboy3742

@freakboy3742 Thanks for the reply. If I understood you correctly, a briefcase package -p zip option is not yet available, right? Actually, it would have helped to have this information about a 'one-folder' distributable in the beeware tutorial or at least at some more prominent place. People which are used to pyinstaller would find this familiar and would not be deterred by the impression of necessarily having to create a msi installer. And I would guess that for the same group of people an option to pack as zip would be interesting.

MarkusPiotrowski avatar Nov 17 '22 22:11 MarkusPiotrowski

@MarkusPiotrowski Correct - the -p zip option isn't currently available; I was describing something that could be added with relatively little additional work.

As for documenting the option - I'm hesitant to document something that doesn't have a clear "artefact" in the same way as an MSI. If it's documented (especially in the tutorial), it becomes part of a public API, which means it's something we're committing to being true long term. If there's a concrete artefact, that makes sense; however, if what we're documenting is "which folders in the build directory can are safe for distribution", that sounds a little more fragile.

freakboy3742 avatar Nov 17 '22 23:11 freakboy3742

@freakboy3742 Again, thank you very much for your response. Then I would vote for a package -p zip option. Maybe a little background for my comments: I'm not talking about commercial software, I'm in academia, where you often want to use or test programs and tools which were written by other scientist. But if I have the options to 'install' a software via unpacking a zip or running an installer, I would always take the zip file. You never know what the installer is actually doing, does it write to the registry, does it change PATH, where does it install? Can I cleanly remove the software? I'm probably not the first person to express discomfort with a msi installer. Again, thank you.

MarkusPiotrowski avatar Nov 18 '22 07:11 MarkusPiotrowski

@MarkusPiotrowski I guess I'm a little surprised by that response, because the problems you describe (where does it install, can it be cleanly removed etc) are what MSI is designed to solve (at least, as I understand it). Installing an MSI means you're providing the operating system with enough detail to undo anything that was done; and installing in a way that the uninstall process can be easily executed.

However, I can't argue that shipping a folder is a simpler option, and doesn't involve any understanding of what MSI will/won't do, so it's probably worth supporting (especially since it has very low implementation requirements).

freakboy3742 avatar Nov 21 '22 05:11 freakboy3742

@freakboy3742 Please excuse my ignorance about msi installers. Actually, what I wrote was my experience about installers in general, and as you wrote (and I have learned now), msi should solve exactly these problems. The final problem is that people like me do not know about the difference and still prefer to ship or receive a folder. Thank you very much for considering a zip package option.

MarkusPiotrowski avatar Nov 21 '22 08:11 MarkusPiotrowski