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 vscode问题请教
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM