it5317998 2016-09-13 04:39 采纳率: 0%
浏览 1199
已结题

C#水晶报表路径设置问题

水晶报表通过安装部署发布以后,到客户机上安装程序,提示水晶报表加载失败,我查了一下是路径设置有问题,我想问一下我要怎么获取我的程序安装的路径呢

  • 写回答

1条回答 默认 最新

  • 张云勇 2016-09-13 05:58
    关注

    ///
    /// 获取文件路径
    ///
    ///
    public static string GetCurrentDirectory()
    {
    string fullName = Assembly.GetExecutingAssembly().GetName().CodeBase;
    string fullPath = Path.GetDirectoryName(fullName);
    if(fullPath.StartsWith("file:"))
    {
    fullPath = fullPath.Substring(6);
    }
    return fullPath;
    }
    ///
    /// 获取文件路径
    ///
    /// 文件名
    ///
    public static string GetCurrentDirectory(string fileName)
    {
    string fullName = Assembly.GetExecutingAssembly().GetName().CodeBase;
    string fullPath = Path.GetDirectoryName(fullName);
    if(fullPath.StartsWith("file:"))
    {
    fullPath = fullPath.Substring(6);
    }
    return fullPath + "\" + fileName;
    }

    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码