我知道在执行代码的同一个目录中有一些文件位于其中。我需要找到他们,并通过另一种方法:获取执行代码所在的目录
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