1.得到当前应用程序的根目录
public static string GetBaseDirectory() { var baseDirectory = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath; if (AppDomain.CurrentDomain.SetupInformation.PrivateBinPath == null) baseDirectory = AppDomain.CurrentDomain.BaseDirectory; return baseDirectory; }