【问题标题】:RDL vs RDLC woes when using custom code and subreports in a local report在本地报告中使用自定义代码和子报告时 RDL 与 RDLC 的问题
【发布时间】:2014-09-22 05:17:33
【问题描述】:

我在使用 SSRS 时遇到了一个相当复杂的问题。

首先,我们使用的是本地报告。我们必须这样做,因为我们使用的数据来自休息服务。

其次,我们为我们想要使用的报表构建了一个名为 ReportFunctions 的自定义库。

我们正在使用 sql server 数据工具来构建 .rdl(不要与 RDLC 混淆),然后我们将文件复制到我们的 VS 项目中。我们将构建操作设置为 Content and Copy If Newer。

这对我们所有的基本报告都很有效。我们甚至可以使用自定义库。

现在我们想将其中一些基本报告用作子报告。我们将此报告称为“AllReports”。它由“SummaryReport”和“DetailReport”组成。

Summary 和 Detail 是两个 RDL 文件,也需要单独加载。

在构建 AllReports 的代码中,我有这个:

reportViewer.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing;

reportViewer.LocalReport.LoadSubreportDefinition("SummaryReport", File.OpenText(Server.MapPath("SummaryReport.rdl")));
reportViewer.LocalReport.LoadSubreportDefinition("DetailReport", File.OpenText(Server.MapPath("DetailReport.rdl")));

private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
    //Set e.DataSources here depending on e.ReportPath
}

当我运行 SummaryReport 或 DetailReport 时,它们运行良好。当我运行 AllReports 时出现错误:

在指定位置 C:\path\to\my\project\Reports\SummaryReport.rdlc 找不到子报表“SummarySubreport”。请确认子报告已发布且名称正确。

为了好玩,我将两个子报告的扩展名切换为 .rdlc 然后在 Visual Studio 中编译时出现构建错误:

加载代码模块时出错:‘ReportFunctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d88351e3d4dffe2f’。详细信息:无法加载文件或程序集“ReportFunctions,Version=1.0.0.0,Culture=neutral,PublicKeyToken=d88351e3d4dffe2f”或其依赖项之一。系统找不到指定的文件。

DetailReport 是使用自定义函数的外部库的一种。

我不能将我的 DLL 放在服务器上的任何地方,除了项目的 bin 中。我不能强调这一点。我也无法转到服务器报告。我必须使用本地报告。

如果我在 RDLC 上将构建操作设置为无,它可以工作,但是当我部署我的 RDLC 时不会发布。

我可以让 RDLC 编译吗?为了让我的报表查看器对我的子报表使用 RDL 而不是 RDLC,我缺少什么?

【问题讨论】:

    标签: ssrs-2008 rdlc rdl report-viewer2010 localreport


    【解决方案1】:

    在解决这个问题 11 个小时后,我发现构建服务器在构建时为所有库分配了修订号。因此,本地 ReportFunctions 将被赋予 1.0.0.0 作为版本,一切都很酷。然后,当它被部署时,构建服务器会做它的事情并且报告会中断。

    对于遇到此问题的其他人,请检查已编译 DLL 的版本号,尤其是在您使用构建过程时。

    此外,为了解决 RDLC 的编译问题,我们将构建操作切换为“无”,并设置构建服务器以在构建成功后手动复制任何 RDLC 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-20
      • 1970-01-01
      • 1970-01-01
      • 2018-03-02
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多