microsoft / microsoft/node-api-dotnet

Path to Microsoft.JavaScript.NodeApi.DotNetHost.dll in electron binary is incorrect

Open
#332 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

electron enhancement
Dominant language
C#
Stars
783
Forks
80
PR merge metrics
No merged PRs in 30d

Description

When electron apps are packaged with ASAR enabled, all binaries get placed inside app.asar archive, but when accessed those need to be accessed via app.asar.unpacked directory if the node module does not use path or fs to resolve file names.

For now I am doing the below inside init.js to get things working on my end, but it would be nice to have this handled within the node-api-dotnet library.

let managedHostPath = __dirname + `/${targetFramework}/${assemblyName}.DotNetHost.dll`
  managedHostPath = managedHostPath.indexOf('app.asar.unpacked') < 0 ? 
    managedHostPath.replace('app.asar', 'app.asar.unpacked') : managedHostPath;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the path construction shown in init.js and how the node-api-dotnet library resolves the managed host DLL when Electron uses ASAR. The work is done when packaged apps locate the DLL through app.asar.unpacked without requiring the caller's workaround; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, electron, javascript, node.js
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.