C# ReportViewer 错误 - 报告的定义“无效。无法加载文件或程序集 Microsoft.ReportViewer.ProcessingObjectMode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18415691/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 12:09:34  来源:igfitidea点击:

ReportViewer error - The definition of the report " is invalid. Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectMode

c#.netwinformsreportviewer

提问by Marek

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.

我的项目中有 ReportViewer。当我在 Vsual Studio 2012 的 InstallShield 中创建此文件的 .exe 时,我将Redistributables Microsoft ReportViewer 2010.

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

当我在 Windows 8 上安装我的应用程序时 - 每个 ReportViewer 都会正确显示它的报告。

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

Windows XP在 ReportViewer 正确加载时遇到问题,但显示此错误而不是正确的报告:

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.

本地报告处理期间发生错误。报表定义无效。报表处理中发生意外错误。

无法加载文件或程序集 Microsoft.ReportViewer.ProcessingObjectMode。版本 =11.0.0.,Culture=neutral,PublicKeyToken=89845dc8080cc91 或其依赖项之一。此系统找不到指定的文件。

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

我确保你在references I have added Microsoft.ReportViewer.Winfroms 11.0.0.0Copy Local = true

How can I solve this issue?

我该如何解决这个问题?

采纳答案by Marek

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

发现这个错误意味着你失踪了Microsoft.ReportViewer.PorcessingObjectMode.dllversion 11.0.0.0。有一种解决方案:

On your Windows 8Machine do following:

在您的Windows 8机器上执行以下操作:

  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 .dllwill be copied to your Cdirectory.

  6. This file simply copy into your Program Fileson Windows XP machineto folder where your application has been installed.

  1. 打开 dos 命令提示符(按 START + R 然后键入 cmd 并按 ENTER)

  2. 键入cd ..,直到你在C:\ >类型Cd windows\assembly\gac_msil\Microsoft.ReportViewer.pro*,然后按回车

  3. 只需输入 cd 11*

  4. 然后输入 copy * c:\

  5. .dll将被复制到你的C目录。

  6. 该文件只复制到您Program FilesWindows XP machine到文件夹的应用程序已经被安装在哪里。

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

希望它对其他人有所帮助,因为我被这个问题困扰了很长时间。

回答by James Toomey

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

Marek 的回答很好,对我有帮助,我只是想添加一个我需要的附加文件。此外

Microsoft.ReportViewer.ProcessingObjectModel.dll

I also needed

我也需要

Microsoft.SqlServer.Types.dll

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

(我正在从具有 SQLServer 但没有 Reporting Services的服务器运行它,所以也许这就是第二个文件丢失的原因。)

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.

正如 Marek 指出的那样,您需要使用命令提示符复制文件,因为 GAC_MSIL 中的 DLL 在 Windows 资源管理器中是隐藏的,因此如果您使用资源管理器搜索它们,您将看不到它们。我被难住了,因为我正在用日常任务生成 PDF,所以我一直在我的日志文件中看到的是一个神秘的错误,"An error occurred during local report processing."我从未看到 ReportViewer 的脸,它至少告诉你丢失的文件。

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

为了解决这个问题,我创建了一个快速测试程序并显示了 ReportViewer,这让我更清楚我需要哪些 DLL: 在此处输入图片说明

回答by Ben

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.

我赞成标记为答案的回复,因为我实际上缺少 .dll - 但我没有按照@Marek 建议的方式修复它。我正在使用 VS2013 并安装 Microsoft.Reporting nuget 包解决了这个问题。我会建议任何有这个问题的人尝试这个。这样,您会自动获得所有依赖项。

enter image description here

在此处输入图片说明

回答by keivan kashani

For the beginning

一开始

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

安装'Microsoft.Report.Viewer''ReportViewer.WebForms''Microsoft.ReportViewer.WinForms''Microsoft.SqlServer.Types' nuget包是必要

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

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

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

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

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

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

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

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

Then it should be check web.config for some tags

然后它应该检查 web.config 的一些标签

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