Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can my precompiled web application not load the RDLC report?

I have a VS2008 Web Application project that is being pre-compiled without being updatable. When I try to load a page that should display an RDLC report using the ReportViewer, it just displays an empty page. It works fine in a non-precompiled version. What could be the problem?

like image 571
Daan Avatar asked Dec 06 '25 09:12

Daan


2 Answers

The problem is that VS also tries to compile the RDLC files, leaving only a marker file instead of the original .rdlc file. The ReportViewer cannot deal with this, and throws an error. This shows up in the logging as:

The report definition is not valid. Details: Data at the root level is invalid. Line 1, position 1.

The solution is to copy the original RDLC files to the deployed application. This can be automated in a post-build step. See also this thread for details on the error and this post on details how to edit the post-build step for a Web Deployment project. I added the following to my Web Deployment project file:

<ItemGroup>
  <ReportFiles Include="$(SolutionDir)Path\To\Reports\*.rdlc" />
</ItemGroup>
<Target Name="AfterBuild">
  <Copy SourceFiles="@(ReportFiles)" DestinationFolder=".\Release\Reports\" />
</Target>
like image 168
Daan Avatar answered Dec 08 '25 21:12

Daan


This solved the problem for me:

https://stephensonger.wordpress.com/2008/09/10/deploying-rdlc-files-in-local-mode-for-asp-net-applications/

That is, I removed the following from web.config and set the Build Action to Content:

<buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
like image 23
Sam Persson Avatar answered Dec 08 '25 22:12

Sam Persson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!