需要有关使用和发布 rdlc 文件的帮助

need help on Using and Publishing rdlc file

我需要有关在 VS 2017 环境中创建的 windows 应用程序中使用 rdlc 文件的帮助。

我在 Publishing RDLC files 上读到了类似的内容,但不确定如何使用 ReportPath,我当前的代码如下所示,在我的机器上从 visual studio 运行时效果很好,我确信它不会在客户端上运行部署后的机器。

MyRptViewer.LocalReport.ReportPath = Application.StartupPath + "/Reports/MyReport.rdlc";

安装时是否会创建 Reports 文件夹并将 .rdlc 文件复制到本地计算机?

如果有人能指导我,我将不胜感激。

谢谢。

您可以将 rdlc 文件构建操作更改为 "embedded resources"

并使用 Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "{AssemblyName}.{ReportName}.rdlc" , 这无需在安装时将报告复制到本地计算机即可工作