I have a .Net core 3.0 application that needs to start another Node.js application through the command line.
How do I do this?
C:\NodeApp>node app.js
Very thanks!
I have a .Net core 3.0 application that needs to start another Node.js application through the command line.
How do I do this?
C:\NodeApp>node app.js
Very thanks!
A better solution than dommilosz's is to just run node.exe from its full path (or include it in your project, that's a bit advanced but if you want you can see this question Embedding an external executable inside a C# program). After that set the process.StartInfo.Arguments
property to the relative or full path of your node.js script. If you wish you can also redirect standard input, error and output of the script by setting these properties of Process.StartInfo
to true, for more intormation about this view the "Properties" section here https://learn.microsoft.com/en-gb/dotnet/api/system.diagnostics.processstartinfo?view=netcore-3.1