如何获取代码所在的程序集的路径?
问题: Is there a way to get the path for the assembly in which the current code resides? 有没有办法获取当前代码所在的程序集的路径? I do not want the path of the calling assembly, just the one containing the code. 我不希望调用程序集的路径,而只是包含代码的路径。 Basically my unit test needs to read some xml test files which are located relative to the dll. 基本上,我的单元测试需要读取一些相对于dll的xml测试文件。 I want the path to always resolve correctly regardless of whether the testing dll is run from TestDriven.NET, the MbUnit GUI or something else. 我希望该路径始终正确解析,而不管测试dll是从TestDriven.NET,MbUnit GUI还是其他版本运行。 Edit : People seem to be misunderstanding what I'm