我最近更新了从.NET 3.5到包含本地报告的.NET 4.0的WinForms应用程序。我在应用程序目录中包含Microsoft.ReportViewer.WinForms
,Microsoft.ReportViewer.Common
和Microsoft.ReportViewer.ProcessingObjectModel
的版本11.0程序集,这是使用.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
。我不明白为什么我有这个新的依赖,即使这是一个本地报告。代码不使用任何高级数据类型或除了.NET 3.5版本中仅使用这三个Microsoft.ReportViewer.*
程序集之外的任何内容。有人可以给我一个有限的列表,用于使用Report Viewer部署.NET 4.0应用程序吗?
答案 0 :(得分: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系统CLR类型包。它可以从SQL Server功能包下载 - 这是指向功能包的最新安装程序列表的链接。
http://www.microsoft.com/en-us/download/details.aspx?id=26728您会看到多个列表,具体取决于x86等。
希望这会有所帮助。
答案 1 :(得分:0)
此错误的主要原因是项目或设置文件无法访问报表查看器DLL,因此请手动将所有以下dll文件重新添加到reportviewer
现在我希望这个错误很容易解决。
答案 2 :(得分:0)
在Manage NuGet Packages中添加: