casademora
casademora

Reputation: 69667

Is it possible to embed and use a portable executable in a .net DLL?

The easiest way to think of my question is to think of a single, simple unix command (albeit, this is for windows) and I need progmatic access to run it.

I have a single command-line based executable that performs some unit of work. I want to call that executable with the .net process library, as I can do with any other executable.

However, it dawned on me that there is potential for the dll to become useless or break with unintended updates to the executable or a non-existant executable.

Is it possible to run the executable from the Process object in the .net framework, as I would an external executable file?

Upvotes: 4

Views: 309

Answers (3)

Steven Murawski
Steven Murawski

Reputation: 11270

Depending on the functionality of the command line program you want to run, it might be possible to duplicate the functionality in PowerShell, where you can embed the PowerShell runtime in your .NET application.

Upvotes: 0

garretmagin
garretmagin

Reputation: 66

No, you can't execute it directly. You could probably unpack it to a temporary directory and execute it from there.

Upvotes: 1

Iain Holder
Iain Holder

Reputation: 14282

Is this where PInvoke can help?

Upvotes: 0

Related Questions