Deploying RDLC files in local mode for ASP.NET applications

Ran into problems trying to deploy my first web application to use a SQL Server Reporting Services report. I created a RDLC file and bound my report viewer control to an object data source. Worked fine on my local machine but as often happens stopped working when I tried it on dev server. First I had to install the Report Viewer Redistributable on the web server. Free download from Microsoft and painless to install. For my reports, I'm running them in local mode. When publishing to a server, I always make sure not to check the "make this web site update-able" option. When I checked the server after publishing, I found my RDLC was just 1KB pointer file as it had been compiled into a DLL and placed in my app's bin directory. Looked for a way to make it publish out as "content" rather than be compiled but couldn't find it. Then it occurred to me to check the web.config file. Sure enough, the answer lied there:

<buildProviders>

<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</buildProviders>

As you can infer from the above, this tells the compiler to compile any RDLC files. I removed this from my web.config and then published again. This time the whole XML for the RDLC file was deployed out to the server as content and the report works as intended. My guess is that this code was added when I dragged the Report Viewer control onto my web page.

--------------------------

Eventually realised you can set the properties for each item in the solution explorer, and set each rdlc file's "Build Action" property to Content, and the "Copy to Output Directory" property to Copy Always.

--------------------------

Try adding the following to you web.config file in between the <compilation> tags:
            <buildProviders>
                <remove extension=".rdlc"/>
                <add extension=".rdlc" type="System.Web.Compilation.ForceCopyBuildProvider"/>
            </buildProviders>
I was having a similar problem with a different file type and this corrected the issue.
JFP

In VS 2008, .rdlc files by default have the "Build Action" in their properties as Embedded Resource. Go into the file's properties and change the Build Action to be Content, and it'll publish the file.

--------------------------

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=372702&wa=wsignin1.0

http://weblogs.asp.net/stephensonger/archive/2008/09/10/deploying-rdlc-files-in-local-mode-for-asp-net-applications.aspx

posted @   emanlee  阅读(1253)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
点击右上角即可分享
微信分享提示