最近写WCF service程序,使用了Image.FromFile(string path)方法,为了使程序可移植,必须使用相对路径。而相对路径可这样写:
string path = AppDomain.CurrentDomain.BaseDirectory+@"Photo\empty.png";
其中,AppDomain.CurrentDomain.BaseDirectory表示程序运行目录,而Photo是放在工程根目录下的文件夹
最近写WCF service程序,使用了Image.FromFile(string path)方法,为了使程序可移植,必须使用相对路径。而相对路径可这样写:
string path = AppDomain.CurrentDomain.BaseDirectory+@"Photo\empty.png";
其中,AppDomain.CurrentDomain.BaseDirectory表示程序运行目录,而Photo是放在工程根目录下的文件夹