Open TonyValenti opened 2 years ago
Tagging subscribers to this area: @agocke, @vitek-karas, @vsadov See info in area-owners.md if you want to be subscribed.
Author: | TonyValenti |
---|---|
Assignees: | - |
Labels: | `area-Single-File` |
Milestone: | - |
Having a GUI and Console version of the app in the same exe seems to be pretty tricky on Windows. Search for example for "windows GUI app with console" there are some good links. The short version is:
AttachConsole
API seems to be he way to go, but there seem to be quite a few problems either way..NET doesn't have any feature which would help with this. In case of single-file, I don't know what should be the meaning of trying to publish two executables into one single-file in a general case. The error should be more explicit, but I don't think .NET should support it.
@vitek-karas I was hoping to leverage the fact that .Net would decompress to a temporary folder to essentially be able to do the following:
This would mean that you're running the CLI (command line) version as a child process. Which may be fine in your scenario (it's frequently not desirable though).
You could probably do this in two ways: Build/publish the CLI exe project explicitly as a target from your "main" exe project file - this is effectively a "Fix" for the failure you're seeing. And then one of the these:
Description
It is not possible to publish a single file EXE that references other EXE files in the project.
Reproduction Steps
Try to publish this attached file: MyApp.zip
Expected behavior
It should work without issue.
Actual behavior
It is not able to publish. This seems to be caused by the build process looking for "singlefilehost.exe" for the "child" EXEs and not finding it.
Regression?
Not sure.
Known Workarounds
None.
Configuration
Windows 11 x64. .NET 6.x in VS 17.2.6
Other information
The goal that I am trying to accomplish is to have a console and WPF version of my application in the same EXE. If there is a better way, I'd love to know.