locked
CS0433: The type Microsoft.Reporting.WebForms.ReportDataSource exists in both GAC and Temporary ASP.NET files RRS feed

  • Question

  • User-1020357127 posted

    After upgrading Microsoft Report Viewer Control for ASP.Net Web Forms applications from version 10 to 15 with Nuget, when published project to server the error below starts to appear. On local machine everything works fine. All ReportViewer reference Copy Local properties are set to True, registered all report pages with appropriate assembly. Tried clearing temp asp.net files, checked for double references in web.config, installed latest version of report viewer on server, nothing helped. Do you have any advice or faced similar issue?

    ----------------------------------------------------------------------------------------------------------------

    Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.             Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportDataSource' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\psshifttracker\3204b50c\1eca333e\assembly\dl3\0941aa88\00019b61_9c4ed401\Microsoft.ReportViewer.WebForms.DLL' Source Error:

    Line 595:      

    Line 596:         [System.Diagnostics.DebuggerNonUserCodeAttribute()]

    Line 597:       private global::Microsoft.Reporting.WebForms.ReportDataSource @__BuildControl__control9() {

    Line 598:             global::Microsoft.Reporting.WebForms.ReportDataSource @__ctrl;

    Line 599:                    

    Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\psshifttracker\3204b50c\1eca333e\App_Web_shiftreport.aspx.dfa151d5.venwfp5b.0.cs               Line:  597            

    Thursday, December 20, 2018 8:34 AM

Answers

  • User-1020357127 posted

    Turns out it is using some DLLs from master application which is using version 10. Reports are in sub application in IIS, when moving the application one level higher reports work fine with the new version. Trying to find a way to make applications independent from the master application, so I could avoid upgrading version of master at the moment ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 27, 2018 9:57 AM

All replies

  • User283571144 posted

    Hi seftero,

    According to your description, it seems the GAC's assembly is not as same as the new ReportViewer version.

    I suggest you could try to modify the web.config to bind redirect from 10.0.0 to 15.0,0.

    More details, you could refer to below web.config.

    Notice: you should modify the version according to your webforms version number.

    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="89845dcd8080cc91" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
          </dependentAssembly>

    Best Regards,

    Brando

    Friday, December 21, 2018 3:18 AM
  • User-1020357127 posted

    Hi Brando,

    Thanks for your answer. I've tried to redirect binding but it didn't helped. Below is the modified web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <connectionStrings> 
      </connectionStrings>
      <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="89845dcd8080cc91" culture="neutral" />
            <bindingRedirect oldVersion="10.0.0.0" newVersion="15.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
     </runtime>
      <system.web>
         <httpHandlers> 
           <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" /> 
         </httpHandlers> 
        <customErrors mode="Off" />
        <sessionState timeout="6000" />
        <compilation debug="true" targetFramework="4.5">
          <assemblies>
            <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    		<add assembly="Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
            <add assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>      
          </assemblies>
          <buildProviders>
    		<remove extension=".rdlc"/>
            <add extension=".rdlc"
              type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
          </buildProviders>
        </compilation>
        <httpRuntime targetFramework="4.5" />
        <authentication mode="Windows" />
        <pages validateRequest="false">    
    		<controls>
    			<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
    		</controls>
    	</pages>
      </system.web>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
    		 <remove name="ReportViewerWebControlHandler" />
    		 <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </handlers>
      </system.webServer>
    </configuration>
    

    Regards,

    seftero

    Friday, December 21, 2018 9:06 AM
  • User283571144 posted

    Hi seftero,

    I suggest you could try below web.config setting.

         <dependentAssembly>
            <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="89845dcd8080cc91" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>

    Best Regards,

    Brando

    Tuesday, December 25, 2018 2:54 AM
  • User-1020357127 posted

    Turns out it is using some DLLs from master application which is using version 10. Reports are in sub application in IIS, when moving the application one level higher reports work fine with the new version. Trying to find a way to make applications independent from the master application, so I could avoid upgrading version of master at the moment ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 27, 2018 9:57 AM
  • User283571144 posted

    Hi seftero,

    I'm glad that you have solved your issue, I suggest you could mark the answer which is right and helpful. This will help other people who faces the same issue to find the right answer more faster.

    Thanks,

    Brando

    Wednesday, January 2, 2019 3:03 AM