简体   繁体   English

尽管安装了先决条件,但无法加载程序集Microsoft.ReportViewer.Common

[英]Could not load assembly Microsoft.ReportViewer.Common, despite installing the prerequisites

So, I've got a C# windows workflow project that creates a report programmatically and emails it out. 所以,我有一个C#windows工作流项目,它以编程方式创建报告并通过电子邮件发送出去。 It works fine on my local machine, but putting it on a scheduler in a different machine generates the following error: 它在我的本地计算机上运行正常,但将它放在另一台计算机上的调度程序中会产生以下错误:

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. 无法加载文件或程序集'Microsoft.ReportViewer.Common,Version = 11.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (HRESULT异常:0x80131040)

Based on other topics, I tried installing MICROSOFT® REPORT VIEWER 2012 RUNTIME from the following address: http://www.microsoft.com/en-us/download/details.aspx?id=35747 . 基于其他主题,我尝试从以下地址安装MICROSOFT®REPORTVIEWER 2012 RUNTIME: http//www.microsoft.com/en-us/download/details.aspx?id = 35747。 This didn't help. 这没有用。 This was the overwhelmingly prevalent solution, but I'd love any other suggestions or advice. 这是一个非常普遍的解决方案,但我喜欢任何其他建议或建议。

The accepted answer pointed me in the right direction. 接受的答案指出了我正确的方向。 However, didn't provide enough details for me to reach resolution. 但是,没有提供足够的细节让我达成解决方案。 I wanted to add this as a comment to that answer but it was too long. 我想将此作为对该答案的评论添加,但它太长了。

In my VS project, I had a reference to Microsoft.ReportViewer.WinForms version 12.0.0.0 and when deploying to another computer got the same error as present in this question. 在我的VS项目中,我引用了Microsoft.ReportViewer.WinForms版本12.0.0.0,当部署到另一台计算机时遇到了与此问题相同的错误。 The key to the problem is a portion of the error: 问题的关键是错误的一部分:

The located assembly's manifest definition does not match the assembly reference. 定位的程序集的清单定义与程序集引用不匹配。

It is telling you that it found a DLL with the right name, but it is the wrong version. 它告诉你它找到了一个具有正确名称的DLL,但它是错误的版本。 I had added a reference to Microsoft.ReportViewer.Common through the references dialog but I didn't catch that the only one listed in the "Extensions" section of the references dialog was for version 10.0.0.0. 我通过引用对话框添加了对Microsoft.ReportViewer.Common的引用,但我没有发现引用对话框的“Extensions”部分中列出的唯一一个是10.0.0.0版本。 So of course it will deploy the wrong one if you are telling it to deploy the wrong one. 所以当然如果你告诉它部署错误的那个,它会部署错误的。

What you have to do is find the Microsoft.ReportViewer.Common.dll file with version 12.0.0.0 on your system and manually include a reference to that. 您需要做的是在您的系统上找到版本为12.0.0.0的Microsoft.ReportViewer.Common.dll文件,并手动包含对该文件的引用。 For me it was in the following directory: 对我来说,它位于以下目录中:

C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.ReportViewer.Common\\12.0.0.0__89845dcd8080cc91\\ C:\\ WINDOWS \\装配\\ GAC_MSIL \\ Microsoft.ReportViewer.Common \\ 12.0.0.0__89845dcd8080cc91 \\

Once I added that reference and set both DLLs to Copy Local in my VS project, then everything worked on the deployed machine. 一旦我添加了该引用并在我的VS项目中将两个DLL设置为Copy Local,那么一切都在已部署的计算机上运行。

Note: I did not require an installation of the Microsoft Report Viewer 2012 Runtime in order to have it work on the deployed machine. 注:我没有要求微软报表查看器2012运行时的安装,以便将它部署的机器上工作。 For any of you like me that were wanting to avoid any other installations during deployment. 对于像我这样想要在部署期间避免任何其他安装的任何人。

尝试将dll文件添加到项目中:C:\\ Program Files \\ Microsoft Visual Studio 10.0 \\ ReportViewer在发布项目后将它们添加到bin文件夹

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集'microsoft.reportviewer.Common version = 11.0.0.0' - could not load file or assembly ' microsoft.reportviewer.Common version=11.0.0.0' 无法加载文件或程序集 'Microsoft.ReportViewer.Common,版本 = 11.0.0.0 - Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0 无法加载文件或程序集“ Microsoft.ReportViewer.Common”或其依赖项之一。 -正在使用文件 - Could not load file or assembly 'Microsoft.ReportViewer.Common' or one of its dependencies. - File is being used System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.ReportViewer.Common,版本=12.0.0.0,文化=中性,PublicKeyToken= - System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken= 无法加载文件或程序集“Microsoft.ReportViewer” - Could not load file or assembly 'Microsoft.ReportViewer' 无法加载文件或程序集Microsoft.ReportViewer.ProcessingObjectModel,版本= 13.0.0.0 - Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectModel, Version=13.0.0.0 无法加载文件或程序集“ Microsoft.ReportViewer.DataVisualization” - Could not load file or assembly 'Microsoft.ReportViewer.DataVisualization' 无法加载文件或程序集'Microsoft.ReportViewer.ProcessingObjectModel',版本8 - Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel,' ver 8 "无法加载文件或程序集“Microsoft.ReportViewer.ProcessingObjectModel,版本=10.0.0.0" - Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0 无法加载文件或程序集Microsoft.ReportViewer.WebForms.XmlSerializers - Could not load file or assembly Microsoft.ReportViewer.WebForms.XmlSerializers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM