asp.netvisual-studiowebformsnugettelerik-reporting

Visual Studio thinks NuGet packages are installed that aren't


I have an ASP.NET Web Forms web site with a dependency on some Telerik packages. When I right-click on the web site in Visual Studio and "Manage NuGet Packages", the packages are listed under the "Installed" tab:

Telerik NuGet packages showing as installed

However:

  1. When viewing Global.asax I get the error "Could not load file or assembly" about Telerik.ReportViewer.Html5.WebForms which seems to be breaking IntelliSense and syntax highlighting
  2. The assemblies don't exist in the web site's Bin directory
  3. When I try to uninstall the packages, nothing happens and they're still listed as installed

Solution

  • It is quite a bit strange since you have installed the package Telerik.ReportViewer.Html5.WebForms.

    Please try the following steps:

    1) disable any third party installed vs extensions under Extensions-->Manage Extensions

    2) clean all nuget caches or delete all files under C:\Users\xxx(current user)\.nuget\packages then rebuild your project.

    3) close VS Instance, delete .vs hidden folder under the solution folder, bin and obj folder, then rebuild your project.

    4) run devenv /safemode under Developer Command Prompt for VS to start a pure VS and then test your project in it.

    Besides, when you finishing checking, please add bindredirect on your main web project.

    add this:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
          <dependentAssembly>
            <assemblyIdentity name="Telerik.ReportViewer.Html5.WebForms" publicKeyToken="eb42632606e9261f" />
            <bindingRedirect oldVersion="0.0.0.0-14.1.20.618" newVersion="14.1.20.618" />
          </dependentAssembly>    
        </assemblyBinding>
      </runtime>
    

    Like this link.

    5) Or you could try to create a new asp net web site project and then install that nuget package to test whether the issue happens again.

    If it still exists, please repair VS or update it to the latest version.

    ===========================================

    Update 1

    clean nuget caches first, delete Bin folder, or just use nuget xxx\xxx.sln to restore the packages, then rerun update-package -reinstall to test again. After that, rebuild your website project.

    Please check on your web.config file and make sure that you have such node:

    <compilation debug="true" targetFramework="4.7.2">
          <assemblies>
            <add assembly="Telerik.ReportViewer.Html5.WebForms, Version=14.2.20.916, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE" />
          </assemblies>
    </compilation>
    

    Make sure that you have referenced such dll in web.config.

    enter image description here

    Then, delete .vs hidden folder and Bin folder then rebuild your project to check whether the dll exists under Bin folder.

    Update 2

    =====================================================

    Finally find the reason.

    It turned out that the problem was caused by another package failing to install. It was one that I'd gotten away with not having installed before so I just ignored it but it looks like if NuGet fails to install a package, it won't even try to install any subsequent packages.