1

的應用解決方案,我正在運行一些其他可執行文件主要是從當前的解決方案。控制從我的主要項目中的多個線程項目

輸出窗口顯示我在退出線程信息時,我懷疑,他們不應該,有什麼使我的問題,我怎麼跑我的應用程序子項目,所以我可以處理哪個是哪個?

mainApp.exesideProj1.exe ...

在主應用程序我做的如下:

public static bool LounchSideProj1Exec() 
{ 
    /* 
    here I could simply call it via Process.Start(); 
    or if I could somehow, execute it via thread start, 
    so I could name the thread and then see it in the output window and other places... 
    */ 
    System.Diagnostics.ProcessStartInfo Pinf = new System.Diagnostics.ProcessStartInfo(); 

    var CurMachingMatchsProcs = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName.ToLower().Equals("sideproj1")); 
    //check count, take first, this is a running process of SideProj1 else excute sideProj1: 
    sideProj1Proc = CurMachingMatchsProcs.First(); 
    //  or else... 

    SideProj1Proc = new System.Diagnostics.Process(); 
    Pinf.FileName = @"G:\...sideProj1.exe"; 
    sideProj1Proc.StartInfo = Pinf; 


    bool okTh = false; 
    ThreadStart ths = new ThreadStart(() => { okTh = sideProj1Proc.Start(); }); 

    Thread th = new Thread(ths); 
    th.Name = "sideProj1THREAD"; 
    th.Start(); 
} 

什麼是正確的方針,以 「保持聯繫」 隨着..Concert執行的項目&主?

+0

_The螺紋 ''(0x1a78)已經退出,代碼0(爲0x0)._ –

回答

0

所以識別的問題,它的線程是

在根據項目名稱主要形式

System.Threading.Thread.CurrentThread.Name = "AppMainTRD"; 

的構造

..

還有一件事,我不知道是我可以執行整個解決方案作爲啓動項目,這將只適用於調試目的,這對於現在是好的。