C# 获取当前的 dll 所在的路径

public static string AssemblyDirectory
{
    get
    {
        string codeBase = Assembly.GetExecutingAssembly().CodeBase;
        UriBuilder uri = new UriBuilder(codeBase);
        string path = Uri.UnescapeDataString(uri.Path);
        return Path.GetDirectoryName(path);
    }
}

Environment.CurrentDirectory瞠目绝对路径

 

 

Application.StartupPath程序运行路径

你可能感兴趣的:(C#winfrom)