views:

64

answers:

1

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?

A: 

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>
Daan