可以利用反射获得当前安装的路径。
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
asm.Location就是当前的安装的路径。
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
asm.Location就是当前的安装的路径。
{
string str = Assembly.GetExecutingAssembly().GetName().CodeBase;
if (str.ToLower().IndexOf("file:///") >= 0)
{
str = str.Substring(8, str.Length - 8);
}
string path = System.IO.Path.GetDirectoryName(str);
return path;
}
给你参考下!