winform 获取当前程序所在目录。

string exePath = new DirectoryInfo(Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName).Parent.FullName;

string apppath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName);//取得当前程序目录

引用 :using System.Reflection;

用 System.Environment.CurrentDirectory 这种方法取得,会在打包安装调用时出现问题。还在用上面的好。

原文地址:https://www.cnblogs.com/runliuv/p/2475488.html