获取源码路径
private static string GetFilePath([CallerFilePath] string path = null)
{
return path;
}
//当程序所在路径
string str67 = System.Environment.CurrentDirectory;
//源码路径
var path = GetFilePath();
var directory = Path.GetDirectoryName(path);
参考