我已经从 Visual Studio 2010 发布了一个 WinForms 应用程序。它使用 .NET 4.0。在“发布” Pane 的先决条件对话框中,我选择了 .NET 4.0 Client Profile 和 Windows Installer 3.0。将应用程序发布到磁盘后,我将其迁移到首先安装了 .NET Client Profile 的客户端计算机,并在重新启动后给出了以下错误消息:
Unable to Install or run application. The application requires that assembly,
Microsoft.ReportViewer.Common
version 10.0.0 in global assembly cache first.
在此消息之后,安装过程退出。我在我的项目中使用 .NET 的报告(不是 Crystal Reports)。
最佳答案
您必须单独部署 ReportViewer 控件。
在 MSDN 上查看更多信息:Deploying Reports and ReportViewer Controls
The ReportViewer control redistributable is a self-extracting file named ReportViewer.exe that includes an .msi and other files. You can find ReportViewer.exe at the following location:
%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\ReportViewer\ReportViewer.exe
You can also download it from the Microsoft Download Center.
[ . . . ]
The type of control you are using determines where ReportViewer.exe should be run.
For ASP.NET applications, run ReportViewer.exe on the Web server that hosts your application. This must be done by a server administrator.
For Windows Forms applications, include the controls as an application prerequisite so that they are installed automatically with your application. You can use the bootstrapping application to automate this step:
Open the project properties page.
Click Publish, and then click Prerequisites.
Select Microsoft Visual Studio 2010 Report Viewer, and then click OK.
Publish the application.
During application installation, a check is performed on the local computer to see if ReportViewer is already installed. If it is not installed, the Setup program will install it.
关于deployment - 部署使用 Microsoft ReportViewer 的 WinForms 应用程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5230858/