安装到其他电脑后C#处理本地报表报错

Error occured during local report processing in C# after installing to other computer

我开发了这个 C# 应用程序,它在我的电脑上运行得很好。所以我为这个应用程序创建了一个安装程序,然后尝试将它安装在我的电脑上,它仍然可以正常运行,没有错误和异常。

但是当我尝试安装到其他电脑时,遇到了异常: .

An error occurred during local report processing.

然后我的报表查看器没有显示应该显示的数据,但它显示了我认为的错误消息。

An error occurred during local report processing. The definition of the report is invalid. An unexpected error occurred in Report Processing. 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.

我使用 System.Data.OleDb 作为我与 MS Access 数据库的连接。

正如我所说,安装的应用程序在我的电脑上运行良好,直到我将它安装到其他电脑上。我不知道是不是出了什么问题。

需要检查的事项:

  1. 是否安装了 Microsoft SQL 服务器功能包?

http://www.microsoft.com/en-us/download/details.aspx?id=26728

  1. 是否安装了office包?

  2. 是否安装了access数据库引擎?

那些应该存在。

您的问题的答案在错误消息中。

An error occurred during local report processing. The definition of the report is invalid. An unexpected error occurred in Report Processing. 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.

在您的计算机中,您有一组 运行 您的应用程序所需的 DLL。它们(DLL)已经存在,因此,安装程序即使缺少安装程序中的一个或多个文件,也不会对程序造成问题。

在另一台计算机上,您缺少一个或多个程序所需的 DLL,而您的安装程序没有提供它们。

因此,您缺少另一台计算机中的 Microsoft.SqlServer.Types 程序集,或者 运行 它所需的 DLL。

我尝试下载 SqlServer.Types dll 并将其安装到其他计算机,但我的应用程序仍然无法运行(出现同样的问题)。 . 然后按照这些步骤。

第 1 步:在 Visual C# 项目中,select

Tab >> Library Package Manager >> Manage NuGet Packages for Solution

第 2 步:

Select the Online Tab and Search ReportViewer

第 3 步:

Select Microsoft.ReportViewer.Windows and install it.

在这些步骤之后,我为我的应用程序创建了另一个安装程序,当我将它安装到其他计算机时,它运行完美,没有错误或异常。 . 谢谢你的帮助。非常感谢!