我看到有一些方法可以获取应用程序文件夹路径:
Application.StartupPathSystem.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().Location)AppDomain.CurrentDomain.BaseDirectorySystem.IO.Directory.GetCurrentDirectory()Environment.CurrentDirectorySystem.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)System.IO.Path.GetDirectory(Application.ExecutablePath)取决于具体情况,最好的方法是什么?
在VS 2010中的MS Test下运行测试时,如何找到执行程序集的路径的等价物?我需要知道测试的运行位置,以便我可以设置它所需的数据文件的相对路径.
我试图找到一个执行测试的相同路径,如果我System.Reflection.Assembly.GetEntryAssembly().Location在执行程序集上使用,我会得到它.谢谢你的帮助.