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 @ 2009-08-21 20:37  emanlee  阅读(1242)  评论(0编辑  收藏  举报