相关疑难解决方法(0)

获取应用程序文件夹路径的最佳方法

我看到有一些方法可以获取应用程序文件夹路径:

  1. Application.StartupPath
  2. System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location)
  3. AppDomain.CurrentDomain.BaseDirectory
  4. System.IO.Directory.GetCurrentDirectory()
  5. Environment.CurrentDirectory
  6. System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
  7. System.IO.Path.GetDirectory(Application.ExecutablePath)

取决于具体情况,最好的方法是什么?

.net c#

470
推荐指数
6
解决办法
55万
查看次数

MS测试:执行测试位置?

在VS 2010中的MS Test下运行测试时,如何找到执行程序集的路径的等价物?我需要知道测试的运行位置,以便我可以设置它所需的数据文件的相对路径.

我试图找到一个执行测试的相同路径,如果我System.Reflection.Assembly.GetEntryAssembly().Location在执行程序集上使用,我会得到它.谢谢你的帮助.

c# mstest

19
推荐指数
2
解决办法
1万
查看次数

标签 统计

c# ×2

.net ×1

mstest ×1