In build - Process cannot find file

Hello.

I’m making a game with Voice Recognition and I made it work alright in the editor. In one of the scripts in the Start function, I call a Process so it can start an external .exe. This .exe is needed in order for the speech recognition to work. I have this .exe in the Assets folder.

But when I make a build of the game I get this error in the output_log.txt file when I start the game.

Win32Exception: The system cannot find
the file specified.

at
System.Diagnostics.Process.Start_shell
(System.Diagnostics.ProcessStartInfo
startInfo, System.Diagnostics.Process
process) [0x00095] in
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:969

at
System.Diagnostics.Process.Start_common
(System.Diagnostics.ProcessStartInfo
startInfo, System.Diagnostics.Process
process) [0x0008e] in
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:1198

at System.Diagnostics.Process.Start ()
[0x0002c] in
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:1210

at (wrapper
remoting-invoke-with-check)
System.Diagnostics.Process:Start ()

at UDP_RecoServer.Start () [0x00030]
in
C:\Users\Valentina\VoiceTest\Assets\Scripts\UDP_RecoServer.cs:32
(Filename:
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs
Line: 969)

Setting up 1 worker threads for
Enlighten. Thread → id: 14b8 →
priority: 1

So the question is how can I run that .exe in the build too? Is there another way I can reference to it?

Thank you.

I think the best approach is to remove the EXE outside of your project. I would do a relative path from the Unity exe to the voice Recognition EXE.

For example,

(Path to the UnityGame.exe)//…bin//VoiceRecognition.Exe

I would also make sure this persist when you make an installer for your game!