ReportViewer error - The definition of the report

2019-05-01 04:42发布

问题:

I have ReportViewer in my project. When I create .exe of this file in InstallShield in Vsual Studio 2012 I add into Redistributables Microsoft ReportViewer 2010.

When I do install my app on Windows 8 - every ReportViewer displays it's report correctly.

I'm having problem on Windows XP the ReportViewer loads correctly but displayes this error instead of correct Report:

An error occurred during local report processing. The definition of the report " is invalid. An unexpected error ocurred in Report Processing.

Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectMode. Version =11.0.0., Culture=neutral, PublicKeyToken=89845dc8080cc91 or one of its dependencies. this system cannot find the file specified.

I ensure you that in references I have added Microsoft.ReportViewer.Winfroms 11.0.0.0 and Copy Local = true.

How can I solve this issue?

回答1:

I upvoted the reply marked as the answer because I was, infact, missing .dlls - but I did not fix it in the manner @Marek suggested. I'm using VS2013 and installing the Microsoft.Reporting nuget package fixed the problem. I would suggest to anyone with this problem trying this. That way, you automatically get all the dependencies.



回答2:

Found out that this error means that you are missing Microsoft.ReportViewer.PorcessingObjectMode.dll version 11.0.0.0. There is one solution:

On your Windows 8 Machine do following:

  1. Open dos command prompt (press START + R then type cmd and press ENTER)

  2. Type cd .. until you are on C:\ > Type Cd windows\assembly\gac_msil\Microsoft.ReportViewer.pro* and press enter

  3. Just type cd 11*

  4. Then type copy * c:\

  5. The .dll will be copied to your C directory.

  6. This file simply copy into your Program Files on Windows XP machine to folder where your application has been installed.

Hope it helps to others as I was stuct with this issue for long time.



回答3:

Marek's answer is great and helped me, I just wanted to add an additional file that mine needed. In addition to

Microsoft.ReportViewer.ProcessingObjectModel.dll

I also needed

Microsoft.SqlServer.Types.dll

(I'm running this from a server that has SQLServer but not Reporting Services so perhaps that's why the 2nd file was missing.)

As Marek pointed out, you need to copy the file using the command prompt because the DLLs in GAC_MSIL are hidden from Windows Explorer, so you won't see them if you search for them using Explorer. I was stumped because I'm generating a PDF with a daily task, so all I kept seeing in my log file was the cryptic error "An error occurred during local report processing." I never saw the ReportViewer's face, which at least tells you the missing file.

To troubleshoot this, I created a quickie test program and displayed the ReportViewer, which made it more clear which DLLs I needed:



回答4:

For the beginning

It is necessary for installing nuget packages of 'Microsoft.Report.Viewer' , 'ReportViewer.WebForms' , 'Microsoft.ReportViewer.WinForms' and also 'Microsoft.SqlServer.Types'

https://www.nuget.org/packages/ReportViewer.WebForms/

https://www.nuget.org/packages/Microsoft.ReportViewer.WinForms/

https://www.nuget.org/packages/Microsoft.Report.Viewer/

https://www.nuget.org/packages/Microsoft.SqlServer.Types/

Then it should be check web.config for some tags

<system.web>
    <compilation debug="true" targetFramework="4.5">
        <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
        </buildProviders>
        <assemblies>
            <add assembly="Microsoft.ReportViewer.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
            <add assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
        </assemblies>
    </compilation>
    <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" validate="false" />

    <assemblyBinding>
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
<system.webServer>
    <handlers>
        <add name="ReportViewerWebControlHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" preCondition="integratedMode" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
    </handlers>
    <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>