My scenario is that I am creating a DLL that contains my reports inside of it and then adding that DLL to my main project. My report is set as an embedded resource, and in my main project I am doing the following to set the report into the ReportViewer.
Assembly assembly = Assembly.LoadFrom("MyAssembly.dll");
Stream stream = assembly.GetManifestResourceStream("MyAssembly.Reports.MyReport.rdlc");
MyReportViewer.LocalReport.LoadReportDefinition(stream);
MyReportViewer.RefreshReport();
Now when I do this, I know that the Report is loading, somewhat, because I can set ReportParameters. If it wasn't loading at all I would be throwing an exception stating the parameter doesn't exist or something to that effect.
Whats happening is that my Report will load said parameters and when I RefreshReport(), I get this.
The source of the report definition has not been specified.
Any clue as to why this would be happening? I feel I might be missing something when it comes to loading reports from a dll. However, when I scoured the Internet it seemed like this was the correct solution.
As a side note, I have a form inside of my .dll that I am calling and loading reports into perfectly fine. However, that is a different case because that form knows specifically where that report is.
In this situation I have a ReportViewer that is not inside the .dll and I am trying to load the .rdlc that's inside the .dll into my ReportViewer that isn't inside the dll.
EDIT To top it off, if I use the following code I can see the file that I need in the dll.
string[] resources = assembly.GetManifestResourceNames();
> "MyApp.Controls.Reports.MyCustomReport.rdlc"
this little piece of code at the beginning of the procedure solved my problem
MyReportViewer.Reset();