Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing RDLC files

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?

Thanks!

like image 431
Jake Avatar asked Aug 13 '10 23:08

Jake


People also ask

How do I publish a Rdlc Report?

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". Using these settings will publish an additional copy of each rdlc file to the bin folder.

What is difference between RDL and Rdlc?

Q: What is the difference between RDL and RDLC formats? A: RDL files are created by the SQL Server 2005 version of Report Designer. RDLC files are created by the Visual Studio 2008 version of Report Designer. RDL and RDLC formats have the same XML schema.

What is a Rdlc file?

What is an RDLC file? The RDLC stands for Report Definition Language Client side. Actually It is an extension of report file created by using Microsoft reporting technology. The SQL Server 2005 version of Report Designer is used to create these files.


2 Answers

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)"

File Properties

File Properties

Application Files

Publish Properties

like image 182
nos Avatar answered Sep 19 '22 12:09

nos


I've been using the answer by @nos for a while, but I noticed that in the publication, the set of .rdlc-files is copied to two places:

  1. The original webapplication project relative location;
  2. Inside the bin folder.

So if I had \Reports\Report1.rdlc, I would find in the published location:

 1. <published folder>\Reports\Report1.rdlc;  2. <published folder>\bin\Reports\Report1.rdlc. 

I don't mean to use copies of the rdlc's in the second location and, indeed, if I delete these, the reports are still generated.

I changed the settings for each rdlc-file to:

Build Action: Content; Copy to Output Directory: Do not copy. 

And now nothing is written to the second location.

like image 41
R. Schreurs Avatar answered Sep 18 '22 12:09

R. Schreurs