0

I have adding the following code into my webconfig file in VS 2015.

<assemblies>
   <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>

Unfortunately, The VS still show the following error:

The type 'IReportServerCredentials' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Totally don't know what wrong of the error, may I know how to solve this error?

Thanks for the help.

DeanOC
  • 7,142
  • 6
  • 42
  • 56
Cheah Eng Teong
  • 39
  • 1
  • 2
  • 12

1 Answers1

1

I don't think that adding the assembly to the config file is going to help you, as I gather you are trying to compile your code into an assembly (which is when you're getting the error in Visual Studio).

You should add the assembly as a file reference to your project.

To do that, right-click the project name in Solution Explorer and select Add.. and Reference..

Then browse to your Microsoft.ReportViewer.WebForms.dll and add the reference.

I believe that you will also need to add a reference to the Microsoft.ReportViewer.Common.dll as well.

This post provides a bit more explanation to the purpose of the assemblies node in the config file. What is the purpose of the Assemblies node in Web.Config?

Bonus info: I've just taken a look at an ASP.Net project that I work on occasionally and have found that the project has file references to the reportviewer dlls AND also has the assemblies listed in the web.config file

  <assemblies>
    <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>

I've just deleted the assemblies node from the config file, rebuilt and redeployed the website, and the reportviewer control still works fine. So that would be evidence in favour of the theory that the config file settings are irrelevant when you're deploying your code in an assembly rather than code-behind source files.

Community
  • 1
  • 1
DeanOC
  • 7,142
  • 6
  • 42
  • 56