How to Load Embedded Report Resource for Publishing

In the previous post, I have discussion how you could build a report on ASP.NET.

The report file is basically an xml file with *.rdlc extension. This file basically describes your layout of your report and other essential information. But when you publish/deploy your web application with the code I have given in the previous post, you will find that your report files are missing.

Why is that?

In this post, I will provide you with a simple solution to this problem.

After you publish with your solution onto an IIS (Internet Information System), you might found that your *.rdlc is no longer there. Why? Because it gets processed alone with your program.


In the “Build Action” property, the report is by default configured as an embedded resource. So if we change that to “Content” and remove the following code from the “Web.conf”:



Theoretically, now, you can upload the report file with your solution when you publish it. (Also, insecure solution, because everyone now can download the report structure).


Another way is to change our code, so that the report viewer will load report from the embedded assembly. This is a simpler solution. Only one line of code in is needed. See below:

this.rptViewer.LocalReport.ReportEmbeddedResource = "DPS.RptExpRequest.rdlc";
//this.rptViewer.LocalReport.ReportPath = "RptExpRequest.rdlc";

We use the ReportEmbeddedResource method to load our report from the assembly. Note the differences between the two path names. To load from the assembly, we need to add our solution name/assembly name prior to the source name. This is telling where the source should be loaded from, in this case, DPS.

Leave a Reply

Your email address will not be published. Required fields are marked *