簡體   English   中英

從其他應用程序運行應用程序時無法加載DLL

[英]Dll cannot loaded when running application from another application

我有兩個應用程序,第一個是我的主應用程序,第二個是調用主應用程序的應用程序。 我想從第二個應用程序運行我的第一個應用程序。 為什么當我的第一個應用程序從第二個應用程序調用時,無法加載DLL?

有人可以告訴我並幫助我嗎?

從另一個應用程序啟動控制台應用程序:

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;
 }

嘗試這個:

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

如果這樣不起作用,請分享錯誤。

我用@Sudipta Maiti答案解決了我的問題,並將dll添加到第二個應用程序中,並且將這兩個應用程序都存儲在一個文件夾中。 :)

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM