Error when using external dll .net framework in the reporting service 2014 report

Charbel Daia Martins 61 Reputation points
2023-09-13T12:03:10.3866667+00:00
Hi, 

I have a project developed in C# in Visual Studio 2008, NET Framework 3.5, SQL Server 2008 Standard with Reporting Service

I migrated to Visual Studio 2019, changed the target framework of all projects to net.framework 4.0,
and changed SQL Server to 2014 Standard with reporting Service

However, I'm having a problem with some reports that use a custom dll that was previously compiled in framework 3.5 and is now compiled in framework 4.0
When trying to deploy it gave the following message:

Error message:
"Severity Code Description Project File Line Suppression State
Error Error loading code module: 'DALPersisteDados, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: Could not load file or assembly 'DALPersisteDados, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 0"


I managed to work around the problem as follows:

In the Visual Studio report we reference the DLL compiled in the 4.0 framework
I copied the DLL compiled in framework 4.0 to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\SSRS

However, in the Reporting Service folder I left the DLL compiled in framework 3.5:
C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\bin

When I try to paste the 4.0 dll into the MSRS12.MSSQLSERVER\Reporting Services\ReportServer\bin folder, it returns the error message mentioned above

I checked the web.config of the C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer folder, the reporting service seems to be
trying to use framework 3.5 and 2.0 I tried to change it manually but without success and I couldn't find anywhere how to make this change

Thanks!

web.config


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <pages validateRequest="false">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <authentication mode="Windows" />
    <identity impersonate="true" />
    <compilation defaultLanguage="c#" debug="false" tempDirectory="C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\">
      <assemblies>
        <clear />
        <add assembly="ReportingServicesWebServer" />
        <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </assemblies>
    </compilation>
    <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
    <sessionState mode="Off" />
    <httpHandlers>
      <add verb="*" path="Reserved.ReportServer" type="Microsoft.ReportingServices.WebServer.ReportServiceHttpHandler, ReportingServicesWebServer" />
      <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, ReportingServicesWebServer, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
    <httpModules>
      <clear />
      <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
      <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
      <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
      <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" />
      <add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
      <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
      <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
      <add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" />
      <add name="Profile" type="System.Web.Profile.ProfileModule" />
      <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </httpModules>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    <httpRuntime executionTimeout="9000" />
    <securityPolicy>
      <trustLevel name="RosettaSrv" policyFile="rssrvpolicy.config" />
    </securityPolicy>
    <trust level="RosettaSrv" originUrl="" />
    <webServices>
      <soapExtensionTypes>
        <add type="Microsoft.ReportingServices.WebServer.RsSoapExtension, ReportingServicesWebServer" priority="1" group="1" />
      </soapExtensionTypes>
      <soapExtensionReflectorTypes>
        <add type="Microsoft.ReportingServices.WebServer.RsSoapExtensionReflector, ReportingServicesWebServer" />
      </soapExtensionReflectorTypes>
    </webServices>
  </system.web>
  <runtime>
    <alwaysFlowImpersonationPolicy enabled="true" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.ReportingServices.Interfaces" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="8.0.242.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="9.0.242.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="10.0.0.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.ReportingServices.ProcessingCore" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="9.0.242.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="10.0.0.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.ReportingServices.ProcessingObjectModel" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="9.0.242.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="10.0.0.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="10.0.0.0" newVersion="12.0.0.0" />
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="msmgdsrv" publicKeyToken="89845dcd8080cc91" />
        <codeBase version="9.0.0.0" href="C:\Program Files\Microsoft Analysis Services\AS OLEDB\120\msmgdsrv.dll" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,693 questions
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,915 questions
0 comments No comments
{count} votes

Accepted answer
  1. AniyaTang-MSFT 12,441 Reputation points Microsoft Vendor
    2023-09-15T09:08:18.7733333+00:00

    Hi @Charbel Daia Martins

    This seems to be a .net issue. I found this similar thread for you: https://stackoverflow.com/questions/5138735/error-this-assembly-is-built-by-a-runtime-newer-than-the-currently-loaded-runti, maybe you can use it as a reference. Hope this helps.

    Best regards,

    Aniya


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.