2010-07-11 58 views
0

salam guyz! 我做了一個項目,我引用了一個.exe文件到它的bin文件夾中,現在在一個按鈕單擊事件中我想排除/提取/將該.exe文件複製到我的計算機上的另一個路徑中。已經安裝了我的應用程序)不包括.exe文件(引用我的應用程序)

在C#

+0

嘗試再解釋,你要複製你把一個EXE在該項目的參考? – kenny 2010-07-11 11:14:08

+0

這是你在追求什麼? http://en.wikipedia.org/wiki/Quine_(computing) – sarnold 2010-07-11 11:15:46

+0

愚蠢的降價,打破與parens urls。愚蠢的SO,禁止第三次編輯。 http://en.wikipedia.org/wiki/Quine_%28computing%29 – sarnold 2010-07-11 11:24:33

回答

0

首先,確保exe文件被複制到bin文件夾,選擇您添加到項目,性質,copy local = true參考。

然後,在運行時和副本檢索「其他」 exe文件的路徑/移動它,你可以做到以下幾點:

using System.IO; 
using System.Reflection; 

// ... 

FileInfo appMainExe = new FileInfo(Assembly.GetExecutingAssembly().Location); 
string appFolder = appMainExe.DirectoryName; 
string theOtherExe = Path.Combine(appFolder, "my_exe_file.exe"); 
File.Copy(theOtherExe, "a_new_full_path"); // or File.Move 
相關問題