简体   繁体   中英

Could not load file or assembly 'Microsoft.ReportViewer'

I understand how this issue is occuring, and I'm confident it's another dll, that needs an older version of 'Microsoft.ReportViewer.WebForms', and I'm guessing the 'Microsoft.ReportViewer.Common' as well.

Before this is marked as a duplicate, answers to this type of question just say to find the offending dll and "dealing with it".

What exactly do I do to allow the offending dll to use the old assembly, while keeping the existing one in my project?

The exact error was:

Could not load file or assembly 'Microsoft.ReportViewer.WebForms,
Version=8.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' 
or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

You can't use 2 versions of the same DLL in a project. It's possible that you are referencing version A of the DLL directly in your project, but that another reference itself makes reference to version B of the DLL. In that case, you have no choice but to either remove the reference with the reference (nested reference), or bring in the version that the nested reference wants to use and use it .

One thing that I find helps in general is that for the properties of my project references, I set "Specific Version" to true . This will help alleviate the application going to the GAC and getting a newer version of the DLL than you want it to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM