I recently inherited a large number of Microsoft RDLC reports where I had to fix a number of issues before the upcoming release. One of my first tasks was to write a quick “RDLC runner” console application to allow me to test the reports locally.
You can download the RDLC Runner from NuGet here. Or run the following command on the NuGet Command window in Visual Studio:
The RDLC Runner is a very simple .NET 4.5 project. It takes two XML input files (parameters and data), the path to the .rdlc file and the name of the output file. You can find more instructions, information and the source code of the package on my **GitHub repo.
I used the test harness to run a sample report so I was confident that all was good.
However, as soon as I run the first “live” report I got the following error message, which is a summary of the stack trace (exception message and inner exception) :
An error occurred during local report processing.
The report definition is not valid. Details: The report definition has an invalid target namespace http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition which cannot be upgraded.
After spending an hour trying to figure out why the namespace was wrong and trying different versions, it turns out that the problem was with the referenced ReportViewer dll in the project. The Microsoft.ReportViewer.WinForms (which contains the main code for rendering and outputting the report) was actually the older 2008 version (10.0.0.0)
To resolve this, remove the bad reference and get the latest (22.214.171.124)/(126.96.36.199) depending on your Visual Studio or .NET framework version from either:
- the GAC (C:\Windows\Assembly)
- or C:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer
You may also notice that there are two different types of ReportViewer so make sure you reference the right one depending on the type of your project (website/console/webforms/WPF):