DNA
DNA•7mo ago

Custom executable icon for `deno compile`?

Is it possible to set a different icon rather than the default deno icon for the executable generated from deno compile?
10 Replies
Deno AI Helper
Deno AI Helper•7mo ago
I wasn't able to find the answer to your question in the official Deno documentation. As of my last update, the deno compile command does not provide an option to customize the icon of the generated executable directly through its command-line interface or API. However, I can suggest that typically, changing an executable's icon is platform-specific and often requires additional tooling outside of the compilation process itself. For instance, on Windows, you might use a resource editor to change the icon after the executable has been compiled. On macOS, you would modify the .app bundle's resources. Please note that this advice is not based on the Deno documentation, and I would recommend double-checking the accuracy of this information and looking for platform-specific tools or methods that can help you achieve your goal.
Fabix
Fabix•7mo ago
Hi, I have the same problem. As soon as i try to change the description/icon of my .exe, it gets corrupted. Even if i just change the plain text in Resource Hacker, the Executable doesn't work anymore.
Leokuma
Leokuma•7mo ago
GitHub
GitHub - Leokuma/wincompile: Compile Deno apps for Windows with cus...
Compile Deno apps for Windows with custom icon and metadata. - GitHub - Leokuma/wincompile: Compile Deno apps for Windows with custom icon and metadata.
Fabix
Fabix•7mo ago
Thank you for the porgramm. wincompile works so far but when we try to implement it to our code that also generates a hash of the compiled .exe ot doesn't save the executable.
DNA
DNA•7mo ago
The system cannot find the file specified.
Leokuma
Leokuma•7mo ago
Do this to see the error message:
const {stdout, stderr} = new Deno.Command('wincompile.cmd', {args: [blablabla keep your args here],
stdout: 'piped',
stderr: 'piped',
}).outputSync();

if (stdout.length) console.log(new TextDecoder().decode(stdout));
if (stderr.length) console.log(new TextDecoder().decode(stderr));
const {stdout, stderr} = new Deno.Command('wincompile.cmd', {args: [blablabla keep your args here],
stdout: 'piped',
stderr: 'piped',
}).outputSync();

if (stdout.length) console.log(new TextDecoder().decode(stdout));
if (stderr.length) console.log(new TextDecoder().decode(stderr));
I suspect you're having problems to load or apply the icon
Fabix
Fabix•6mo ago
The first character of the ProductVersion must be a number.
FileVersion can only contain numbers and dots, and must begin with a number.
The first character of the ProductVersion must be a number.
FileVersion can only contain numbers and dots, and must begin with a number.
Thats the error i'm getting And if i remove the arg that's causing the error, i'm getting other errors
Fatal error: Unable to set icon
Fatal error: Unable to set icon
So If i remove the arguments: --Icon, --FileVersion, --ProductVersion it works But if i run wincompile just in Terminal, it doesn't have any problems with my icon
Leokuma
Leokuma•6mo ago
Maybe you have to separate the argument name from argument value
Fabix
Fabix•6mo ago
So, The problem is fixed, it works. The problem was that this "" was unecessery. I noticed that in the properties of the .exe for example the Description was "UniConvert" not UniConvert. I removed the quotation marks and it works perfectly
Leokuma
Leokuma•6mo ago
{args: ['--LegalCopyright', 'OhHellNaw']} instead of {args: ['--LegalCopyright=OhHellNaw']} 👍