怎么利用C#返回 当前 应用程序的 路径? Application.StartupPath???C# winform 开发群,群号:57718204,我们期待您的加入!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Windows.Forms; 命名空间Application.ExecutablePath; 包括可执行文件名称Application.StartupPath; 不包括打执行文件名称 Application.ExecutablePath //包括可執行文件的名稱Application.StartupPath //不包括可執行文件的名稱 如果是asp.net环境,请使用Server.MapPath("./Model.htm") webform:Server.MapPath("~")winform:Application.StartupPath 楼主问的是WEB还是桌面软件?上面的几位把答案都列出来了。 .net2008相关技术,sliverlight,linq,db 开发群,群号:39698106 '当前应用程序所在的目录路径System.Environment.CurrentDirectory'当前应用程序的绝对路径System.Windows.forms.Application.ExecutablePath; using System.Windows.Formsstring 路径=Application.StartupPath Application.StartupPath 这个是肯定可以的。你再好好看看你的代码是不是出了什么问题,或者贴出相关代码大家看一看 string strAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName); ...... string strAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName); ...... '当前应用程序所在的目录路径 System.Environment.CurrentDirectory '当前应用程序的绝对路径 System.Windows.forms.Application.ExecutablePath;注意:LZ,你Debug的时候,这个路径是指到你项目做的文件夹的debug\bin这的可以不要以为是在项目的文件夹.那肯定就不对了噻 C# Socket 有关“&”的问题:两个枚举之间进行“&”运算是什么意思? vs.net环境中能否用水晶报表api编程 怎样把数据绑定到ToolStripComboBox的ComboBox里? 小弟想写一个论坛,望大家给点可行性的建议,谢谢! 请教~~~C#中,在读取文件时,怎样以字节数来读取文件中的内容. 诚心求教,string长度问题 请教一个很简单的小程序问题 SMTP发送邮件出错,请大家帮忙! 如何用c#操作access 如果用Windows窗体内嵌IE的话,可否自行设定窗口里IE的打开方式(新建窗口,原窗口)? 进度条
Application.StartupPath //不包括可執行文件的名稱
Server.MapPath("~")winform:
Application.StartupPath
上面的几位把答案都列出来了。
'当前应用程序所在的目录路径
System.Environment.CurrentDirectory'当前应用程序的绝对路径
System.Windows.forms.Application.ExecutablePath;
......
......
System.Environment.CurrentDirectory '当前应用程序的绝对路径
System.Windows.forms.Application.ExecutablePath;
注意:LZ,你Debug的时候,这个路径是指到你项目做的文件夹的debug\bin这的
可以不要以为是在项目的文件夹.那肯定就不对了噻