发布 RDLC 文件 [英] Publishing RDLC files

查看:19
本文介绍了发布 RDLC 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 WPF 应用程序中有几个 RDLC 文件.当我发布项目时,报告文件不会发布,当我尝试通过客户端访问它们时,我收到一条错误消息,指出找不到它们.我检查了发布文件夹,确实,它们不在那里.我使用以下代码调用 RDLC 文件:

I have a few RDLC files in my WPF application. When I publish the project, the report files don't get published, and when I try to access them with the client I get an error saying that they're not found. I've checked the publish folder, and indeed, they're not there. I call the RDLC files with the following code:

Microsoft.Reporting.WinForms.ReportViewer rvReportViewer;
/* ... */
rvReportViewer.LocalReport.ReportPath = string.Format("Reports/{0}.rdlc", ReportName);

我已经尝试将这些构建操作设置为资源",这是我的静态图像文件所拥有的,但这似乎没有任何区别.

I've tried setting the Build Action on these to "Resource", which is what I have for my static image files, but that doesn't seem to make any difference.

为什么报告没有被复制到发布目录?有没有办法强制这种情况发生,或者我应该以其他方式访问它们?

Why don't the reports get copied to the publish directory? Is there a way to force this to happen, or should I be accessing them in some other way?

谢谢!

推荐答案

我不知道 RDLC 文件是否有特殊问题,但这是确保其他文件得到发布的一般方法.

I don't know if there's special concerns with RDLC files, but here's the general approach for making sure other files get published.

右键单击解决方案资源管理器中的文件,选择属性.将构建操作"设置为内容",将复制到输出目录"设置为如果更新则复制".

Right click the file in the solution explorer, select Properties. Set the "Build Action" to "Content", and "Copy to output Directory to "Copy if newer".

进入项目属性->发布页面.点击应用程序文件按钮",选中显示所有文件".将发布状态"设置为包含(自动)"

Go to the project properties->Publish page. Hit "Application Files Button", check "Show all files". Set the "Publish Status" to "Include (auto)"

文件属性

应用程序文件

这篇关于发布 RDLC 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆