10

我最近将包含本地报告的 WinForms 应用程序从 .NET 3.5 更新到 .NET 4.0。Microsoft.ReportViewer.WinForms我在应用程序目录中包含了、Microsoft.ReportViewer.Common和的 11.0 版程序集Microsoft.ReportViewer.ProcessingObjectModel,这是使用 .NET 3.5 部署此应用程序所需的全部内容,但在使用 .NET 4.0 但没有 VisualStudio 或 SQL Server 的目标计算机上出现以下错误:

TYPE: Microsoft.Reporting.WinForms.LocalProcessingException
MSG: An error occurred during local report processing.
SOURCE: Microsoft.ReportViewer.WinForms
SITE: EnsureExecutionSession
   at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
   at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
   at Ceoimage.Basecamp.MaintainDocumentIntegrity.ReportContainer._SetReportParameters(String departmentName, String footer)
   at Ceoimage.Basecamp.MaintainDocumentIntegrity.ReportContainer._RefreshReport(DataTable sourceTable, String sourceName, String reportResourceName, String departmentName, String footer)
   at Ceoimage.Basecamp.MaintainDocumentIntegrity.ReportContainer.ShowMissingReport(MissingFilesDataTable missingTable, String departmentName, String footer)
   at Ceoimage.Basecamp.MaintainDocumentIntegrity.DocumentIntegrityForm._HandleMissingComplete(Object sender, RunWorkerCompletedEventArgs e)

-- INNER EXCEPTION --
TYPE: Microsoft.Reporting.DefinitionInvalidException
MSG: The definition of the report '' is invalid.
SOURCE: Microsoft.ReportViewer.Common
SITE: CompileReport
   at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)
   at Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot)
   at Microsoft.Reporting.LocalService.CompileReport()
   at Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport()
   at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()

-- INNER EXCEPTION --
TYPE: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
MSG: An unexpected error occurred in Report Processing.
SOURCE: Microsoft.ReportViewer.Common
SITE: CreateIntermediateFormat
   at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext, IDataProtection dataProtection)
   at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)

-- INNER EXCEPTION --
TYPE: System.IO.FileNotFoundException
MSG: Could not load file or assembly 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
SOURCE: Microsoft.ReportViewer.Common
SITE: Write
FILE: Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
   at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.Write(Object obj, Boolean verify, Boolean assertOnInvalidType)
   at Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Serialize(IntermediateFormatWriter writer)
   at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.Write(IPersistable persistableObj, Boolean verify)
   at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.WriteVariantOrPersistable(Object obj)
   at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateHashForCachedDataSets()
   at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)
   at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(Byte[] definition, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)
   at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, IDataProtection dataProtection, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)
   at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext, IDataProtection dataProtection)

我尝试运行Report Viewer 2012 Redistributable,但它也抱怨Microsoft.SqlServer.Types. 我不明白为什么我有这个新的依赖,即使这是一份本地报告。该代码不使用任何高级数据类型或任何超出它在仅需要这三个Microsoft.ReportViewer.*程序集的 .NET 3.5 版本中使用的数据类型。有人可以给我一个有限的要求列表,以使用 Report Viewer 部署 .NET 4.0 应用程序吗?

4

3 回答 3

5

您为 Report Viewer 2012 Redistributable 提供的链接在最底部有一些信息。

附加信息

服务器处理模式的先决条件 Microsoft SQL Server 2008 Reporting Services 或更高版本。NET Framework 3.5 SP1 或 .NET Framework 4.0 SQL Server 系统 CLR 类型包

看起来您缺少 SQL Server System CLR Types 包。它可以从 SQL Server 功能包下载——这里是功能包安装程序最新列表的链接。

http://www.microsoft.com/en-us/download/details.aspx?id=26728您将看到多个列表,具体取决于 x86 等。

希望这会有所帮助。

于 2013-02-06T06:33:07.827 回答
0

出现此错误的主要原因是项目或设置文件无法访问报表查看器 dll,因此请手动添加以下所有与报表查看器相关的 dll 文件

  1. Microsoft.ReportViewer.Common
  2. Microsoft.ReportViewer.ProcessingObjectModel
  3. Microsoft.ReportViewer.WinForms
  4. Microsoft.ReportViewer.DataVisualization

现在我希望这个错误能轻松解决。

于 2014-03-14T07:52:19.233 回答
0

在管理 NuGet 包中添加:

  1. Microsoft.SqlServer.Types
  2. Microsoft.ReportViewer.Window。
于 2015-11-26T21:19:25.620 回答