用户操作
[即时聊天] [发私信] [加为好友]
pengdeanID:pengdean
10053次访问,排名11772(1),好友6人,关注者7人。
pengdean的文章
原创 49 篇
翻译 0 篇
转载 7 篇
评论 3 篇
最近评论
terry183:空的???
sabre:哥们儿,咱能不能居左?
jianglihuif1:学习了, 支持
文章分类
    收藏
      相册
      存档
      软件项目交易
      订阅我的博客
      XML聚合  FeedSky
      订阅到鲜果
      订阅到Google
      订阅到抓虾
      订阅到BlogLines
      订阅到Yahoo
      订阅到GouGou
      订阅到飞鸽
      订阅到Rojo
      订阅到newsgator
      订阅到netvibes

      原创 C#获取项目程序路径的方法 收藏

      新一篇: 弄明白configurationManger这个类的修改 | 旧一篇: 精华网址

      1.asp.net webform用“Request.PhysicalApplicationPath获取站点所在虚拟目录的物理路径,最后包含“\”;
      2.c# winform用
      A:“Application.StartupPath”:获取当前应用程序所在目录的路径,最后不包含“\”;
      B:“Application.ExecutablePath ”:获取当前应用程序文件的路径,包含文件的名称;
      C:“AppDomain.CurrentDomain.BaseDirectory”:获取当前应用程序所在目录的路径,最后包含“\”;
      D:“System.Threading.Thread.GetDomain().BaseDirectory”:获取当前应用程序所在目录的路径,最后包含“\”;
      E:“Environment.CurrentDirectory”:获取当前应用程序的路径,最后不包含“\”;
      F:“System.IO.Directory.GetCurrentDirectory”:获取当前应用程序的路径,最后不包含“\”;
      3.c# windows service用“AppDomain.CurrentDomain.BaseDirectory”或“System.Threading.Thread.GetDomain().BaseDirectory”;
      用“Environment.CurrentDirectory”和“System.IO.Directory.GetCurrentDirectory”将得到“ system32”目录的路径;
      如果要使用“Application.StartupPath”或“Application.ExecutablePath ”,需要手动添加对“System.Windows.Forms.dll ”的引用,并在程序开头用“using    System.Windows.Forms”声明该引用;
      class library中怎么取自己所在路径?
      string strDllFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
      FileInfo fi = new FileInfo(strDllFile);
      return fi.Directory.FullName;

       

      发表于 @ 2008年01月08日 21:15:00|评论(loading...)|编辑

      新一篇: 弄明白configurationManger这个类的修改 | 旧一篇: 精华网址

      评论

      #sabre 发表于2008-05-08 22:14:07  IP: 221.219.215.*
      哥们儿,咱能不能居左?
      发表评论  


      当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
      Csdn Blog version 3.1a
      Copyright © pengdean