0

I'm following this post to try to setup a C# native messaging host. C# native host with Chrome Native Messaging

I've got my sample running where I an launch Calc.exe from a bat file, like this:

host.json

{
  "name": "tsetools",
  "description": "TSE tools for Chrome",
  "path": "tse-host.bat",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://ddemkjpofammommjpcmkhpajoccdjcdg/"
  ]
}

tse-host.bat

@echo off
CD C:\Windows\System32
start calc.exe

The above works fine & launches Calc.exe

But if I change host.json to the following:

{
  "name": "tsetools",
  "description": "TSE tools for Chrome",
  "path": "TSEChromeHost.exe",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://jahdheagjlkdjcoeibobaphodgpgpacc/"
  ]
}

I never see "TSEChromeHost.exe" get launched in the task manager. I've built the C# code from the post above without any errors & can lunch it manually. I have "TSEChromeHost.exe" in the same folder as my "host.json" file.

Any ideas as what I'm doing wrong?

Community
  • 1
  • 1
Barry Ralphs
  • 193
  • 10

2 Answers2

0

I think issue is that TSEChromeHost.exe can't be located. Try this:

You need to change tse-host.bat file like this ( you need to change your working directory to dir where TSEChromeHost.exe is located )

@echo off
Pushd D:\SomeDir 
start TSEChromeHost.exe

Change D:\SomeDir to driectory where TSEChromeHost.exe file is located.

And Also Set path key in host.json file like this: ( as in first example )

"path": "tse-host.bat"
bot_insane
  • 2,545
  • 18
  • 40
  • Thanks for the reply. It now launching my "TSEChromeHost.exe", but it doesn't seem to be receiving any messages. I thought if "host.json" was calling a .bat file, that the messages would also be sent to the .bat file & of course that doesn't work. So how do I get the message to be sent to "TSEChromeHost.exe"? – Barry Ralphs Oct 13 '15 at 17:48
  • This post shows calling the native host app directly: http://stackoverflow.com/questions/24219144/native-messaging-chrome – Barry Ralphs Oct 13 '15 at 18:05
0

Try to specify full path to your TSEChromeHost.exe. On Linux and OSX the path must be absolute. On Windows it can be relative to the directory in which the manifest file is located. (See this documentation)

"path": "Full_path_to_TSEChromeHost.exe"

eg

"path": "C:\\TestFolder\\TSEChromeHost.exe"