nwutils/nw-builder

Win64 build icon not showing up

rocketVibes opened this issue · 25 comments

Issue Type

  • Bug Report
  • Feature Request
  • Other

Current/Missing Behaviour

Provided icon file within app as specified in migration documentation -- icon doesn't appear for win64 build.

Expected/Proposed Behaviour

Icon should be properly linked.

Additional Info

await nwbuild({
        mode: 'build',
        version: '0.70.0',
        flavor: 'normal',
        platform: platform,
        arch: "x64",
        outDir: './build/example-tool/win64',
        srcDir: './Settings.json ./package.json ./config.json ./dist/**',
        app: {
            name: 'example-tool',
            productName: 'Example Tool',
            productVersion: version,
            fileVersion: version,
            companyName: 'rocketVibes International, Inc.',
            legalCopyright: `Copyright ${new Date().getFullYear()} rocketVibes International, Inc.  All rights reserved.`,
            originalFilename: 'example-tool.exe',
            icon: './dist/assets/images/example-tool.ico'
        }
    });
  • Package version: 4.2.4
  • Operating System: MacOC Ventura
  • Node version: 18.16.0
  • NW.js version: 0.70.0

@rocketVibes afk will look into in next couple hours

Please better describe "icon doesn't appear". This is likely the following NW.js issue: nwjs/nw.js#8039

Sorry, just saw you're using 0.70.0. So, it wouldn't be the same issue.

Does this only happen when building for Windows in macOS?

@rocketVibes Renaming Windows executable fields is done by rcedit. To use rcedit on non-Windows platforms, you will have to install Wine. If it still does not work, it is probably a bug in nw-builder or Wine.

@sysrage @ayushmanchhabra icon does not seem to work when building for Mac

await nwbuild({
    mode: 'build',
    version: '0.70.0',
    flavor: 'normal',
    platform: 'osx',
    arch: 'x64',
    srcDir: './Settings.json ./package.json ./config.json dist/**',
    outDir: './build/some-tool/osx64',
    icon: './dist/assets/images/some_configuration.icns',
    macIcns: './dist/assets/images/some_configuration.icns',
    app: {
        name: 'some-tool',
    }
});

@rocketVibes Renaming Windows executable fields is done by rcedit. To use rcedit on non-Windows platforms, you will have to install Wine. If it still does not work, it is probably a bug in nw-builder or Wine.

@ayushmanchhabra Installing Wine did not seem to help atleast on Mac. No issues when building on Windows 10 though.

I'm having trouble getting my windows app metadata to propagate. Wine hasn't worked for me either.

@swissraul icon is to be set inside options.app object:

{
  app: {
    icon: './dist/assets/images/some_configuration.icns',
  }
}

You can also set the path to icon in the NW.js manifest file (the package.json inside the package.nw directory). This works cross platform. Read more here:
https://nwjs.readthedocs.io/en/latest/References/Manifest%20Format/#icon

I haven't got around to updating MacOS metadata info. @sysrage could you look into #742? Doesn't have to be a complete solution maybe just update the important info like icon or legal copyright?

@rocketVibes Works for me on Windows 11 (Updating Windows metadata should work on Windows 10 too). One thing to keep in mind is the metadata file path should start from the current working directory which executes the nwbuild function.

Let's you're in /nwapp and nwbuild function lives in /nwapp/cfg/bld.mjs while icon lives in nwapp/src/icon.ico.

cfg/bld.mjs:

nwbuild({
  app: {
    icon: "src/icon.ico"
  }
});

To run a build, you would execute node cfg/bld.mjs with /nwapp being your current working directory.

Here's a working example for more clarity:
https://github.com/ayushmanchhabra/focus/tree/45dbd823bd76c152b60bbecd021fa81a632c0204

@swissraul icon is to be set inside options.app object:

{
  app: {
    icon: './dist/assets/images/some_configuration.icns',
  }
}

You can also set the path to icon in the NW.js manifest file (the package.json inside the package.nw directory). This works cross platform. Read more here: https://nwjs.readthedocs.io/en/latest/References/Manifest%20Format/#icon

I haven't got around to updating MacOS metadata info. @sysrage could you look into #742? Doesn't have to be a complete solution maybe just update the important info like icon or legal copyright?

@ayushmanchhabra Setting the icon inside of the app section did not work, I already tried that initially (sorry forgot to mention). I'm using nw-builder 4.2.6

icon does not seem to work when building for Mac

@swissraul just got access to a Mac, I'll work on #742 within the next 2 days.

Setting the icon inside of the app section did not work, I already tried that initially (sorry forgot to mention). I'm using nw-builder 4.2.6

Try setting icon via NW manifest (package.json)?

@ayushmanchhabra the following is how I am trying to set my mac icon:

 await nwbuild({
        mode: 'build',
        version: '0.70.0',
        flavor: 'normal',
        platform: 'osx',
        arch: 'x64',
        srcDir: './Settings.json ./package.json ./config.json dist/**',
        outDir: './build/example-tool/osx64',
        icon: './dist/assets/images/example-tool.icns',
        app: {
            name: 'example-tool'
        }
    });

The default app icon is being set instead. Let me know if I've configured this improperly.

@rocketVibes icon should be inside app:

{
  app: {
    icon: "...",
  }
}

@ayushmanchhabra tried this instead, same result.

await nwbuild({
        mode: 'build',
        version: '0.70.0',
        flavor: 'normal',
        platform: 'osx',
        arch: 'x64',
        srcDir: './Settings.json ./package.json ./config.json dist/**',
        outDir: './build/example-tool/osx64',
        app: {
            name: 'example-tool',
            icon: './dist/assets/images/example-tool.icns',
        }
    });

Mac Ventura

I realise what's going on. app.icon does not work for MacOS. I have yet to update the MacOS metadata (Plist file) in #742

@rocketVibes Probably not what you wanted to hear. There is a Info.plist file which handles Mac app metadata. If you're in a hurry I'd suggest playing around with that until you have something that works.

I'm aiming to do a minor release by Monday which would have the ability to update MacOS metadata among other things.

@rocketVibes This took a while but I figured out what the issue with the icon is. It is a bug indeed!

@ayushmanchhabra I have built for osx64 using version 4.3.0 and I am still not seeing the icon file I specify listed in the Info.plist. However, when I look at the built app, I no longer see the default nwjs icon shown, but the blank Mac default.

@swissraul @rocketVibes you're confusing everyone by using the same GitHub Issue for two separate reports. The title of this issue is for a Win64 build and that's what's described in the original report. If you're encountering an issues with the macOS build icon, open a separate issue with full details.

@sysrage I totally agree - however, if it's just a configuration error on my part then I wanted to clarify that before making a full report. I will log it as a separate issue. Apologies for the spam.

@rocketVibes you will need to set the icon via package.json:
https://nwjs.readthedocs.io/en/latest/References/Manifest%20Format/#icon

This should work for all platforms! The path to icon is relative to the package.json file path.

@ayushmanchhabra if I run build for win64 app on my Windows machine, my icon is correctly set. If I run win64 build from linux, it is not. Any advice?

Try installing Wine

@ayushmanchhabra I have done that as well. No change to blank icon.

At this point I'd suggest to not build Windows app on Linux. I've run into problems using rcedit recently. I'll have to dig into why its not working. Also there has not been a lot of activity on the repo itself.