简体   繁体   English

无法使用 visual studio 2019 加载文件或程序集“microsoft.reportviewer.winforms”

[英]could not load file or assembly 'microsoft.reportviewer.winforms' using visual studio 2019

I am using visual studio 2019 with .NET framework 4.7.2 for my WinForms project.我正在为我的 WinForms 项目使用带有 .NET 框架 4.7.2 的 visual studio 2019。 I have a report form that works fine when I run the project from Visual Studio, but when I run the ".exe" file inside bin/debug/app.publish folder, I am getting below error:当我从 Visual Studio 运行项目时,我有一个报表可以正常工作,但是当我在 bin/debug/app.publish 文件夹中运行“.exe”文件时,出现以下错误:

Could not load file or assembly 'Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.无法加载文件或程序集“Microsoft.ReportViewer.WinForms,Version=15.0.0.0,Culture=neutral,PublicKeyToken=89845dcd8080cc91”或其依赖项之一。 The system cannot find the file specified.该系统找不到指定的文件。 File name: 'Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'文件名:'Microsoft.ReportViewer.WinForms,版本=15.0.0.0,文化=中性,PublicKeyToken=89845dcd8080cc91'

In my project, I have tried在我的项目中,我尝试过

"Corrected.Microsoft.ReportingServices.ReportViewerControl.Winforms 150.1358.0" “Corrected.Microsoft.ReportingServices.ReportViewerControl.Winforms 150.1358.0”

as well as

"Microsoft.ReportingServices.ReportViewerControl.Winforms 150.1537.0" “Microsoft.ReportingServices.ReportViewerControl.Winforms 150.1537.0”

Both packages installes the following dll inside my project:这两个包都在我的项目中安装了以下 dll:

Microsoft.ReportViewer.Common
Microsoft.ReportViewer.DataVisualization
Microsoft.ReportViewer.Design
Microsoft.ReportViewer.ProcessingObjectModel
Microsoft.ReportViewer.WinForms

I have tried many suggested solutions from Stack overflow and other resources but none of them solved may problem.我已经尝试了 Stack overflow 和其他资源中的许多建议解决方案,但没有一个解决了问题。

下图显示了我的项目引用中的 dll 文件

ok, it seems like there reference mismatch that nuget isn't cleaning up.好的,似乎 nuget 没有清理的引用不匹配。 It could be a package reference in the csproj file or app.config.它可能是 csproj 文件或 app.config 中的 package 引用。 You'll have to manually edit it out.您必须手动编辑它。

One workaround though is to take the dll you want, copy it into a lib folder outside of the build folder that gets cleaned and reference that dll. You can reference the dll in your new lib folder by right clicking your project and then going to add > project refence.不过,一种解决方法是获取所需的 dll,将其复制到已清理的构建文件夹之外的 lib 文件夹中,并引用该 dll。您可以通过右键单击项目然后添加来在新的 lib 文件夹中引用 dll > 项目参考。 Then you can browse to the correct one.然后您可以浏览到正确的那个。

暂无
暂无

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

相关问题 我如何在 Microsoft.ReportViewer.WinForms 中更改报告显示 - How I could change report presentation in Microsoft.ReportViewer.WinForms 无法加载文件或程序集“Microsoft.ReportViewer” - Could not load file or assembly 'Microsoft.ReportViewer' 该应用程序要求首先在全局程序集缓存(GAC)中安装程序集Microsoft.ReportViewer.WinForms版本11.0.0.0。 - The application requires that assembly Microsoft.ReportViewer.WinForms Version 11.0.0.0 be installed in the Global Assembly Cache (GAC) First 无法在 Visual Studio 2019 16.2 中加载文件或程序集 Microsoft.VisualStudio.Coverage.Analysis - Could not load file or assembly Microsoft.VisualStudio.Coverage.Analysis in Visual Studio 2019 16.2 无法加载文件或程序集'microsoft.reportviewer.Common version = 11.0.0.0' - could not load file or assembly ' microsoft.reportviewer.Common version=11.0.0.0' 无法加载文件或程序集'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.Common,版本 = 11.0.0.0 - Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0 无法加载文件或程序集Microsoft.ReportViewer.WebForms.XmlSerializers - Could not load file or assembly Microsoft.ReportViewer.WebForms.XmlSerializers 无法加载文件或程序集Microsoft.ReportViewer.ProcessingObjectModel,版本= 13.0.0.0 - Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectModel, Version=13.0.0.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM