我知道在執行代碼的同一個目錄中有一些文件位於其中。我需要找到他們,並通過另一種方法:獲取執行代碼所在的目錄
MyLib.dll
Target1.dll
Target2.dll
Foo(new[] { "..\\..\\Target1.dll", "..\\..\\Target2.dll" });
所以我打電話System.IO.Directory.GetFiles(path, "*.dll")
。但現在我需要知道的路徑:
string path = new FileInfo((Assembly.GetExecutingAssembly().Location)).Directory.FullName)
但有更多的短路?
[This post](http://stackoverflow.com/questions/3163495/better-way-to-get-the-base-directory)應該給你幾個選項 – mhenrixon 2010-07-17 11:47:36