novian kristianto
novian kristianto

Reputation: 761

Dll cannot loaded when running application from another application

I have two application, first is my main application and second is application to call main application. I want to run my first application from second application. why when my first application was calling from second application, the DLL could not be loaded?

Can someone tell me and help me?

Upvotes: 0

Views: 51

Answers (3)

novian kristianto
novian kristianto

Reputation: 761

I solved my problem with @Sudipta Maiti answer and I add dll into second application, and I store both off my application in one folder. :)

thank you

Upvotes: 0

Juran
Juran

Reputation: 177

try this:

Process ExternalProcess = new Process();
                ExternalProcess.StartInfo.FileName = "ConsoleApplication.exe";
                ExternalProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                ExternalProcess.Start();
                ExternalProcess.WaitForExit();

if this won't work, kindly share the error.

Upvotes: 0

Sudipta Kumar Maiti
Sudipta Kumar Maiti

Reputation: 1709

Launch console application from another application:

using System.Diagnostics;

 ProcessStartInfo processInfo = new ProcessStartInfo();
 processInfo.Arguments = "Some argument";
 processInfo.FileName = "Your console .exe path"; 
 int exitCode;

 using (Process process = Process.Start(processInfo))
 {
            process.WaitForExit();
            exitCode = process.ExitCode;
 }

Upvotes: 1

Related Questions