[Solved] iText7 Version of conflict on solution in ASP.Net

Last Reply 13 days ago By dharmendr

Posted 13 days ago

Hi,

On my solution I have installed the SDK iText 7 v7.1.14 and pdfHTML v3.0.3 add-on for C# (.NET)

In the folder package of solution

enter image description here

There is an old folder named itext7.7.1.13 that which I renamed itext7.7.1.13_old

The problem is the web.config file, because if delete these rows

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="itext.styledxmlparser" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="itext.layout" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="itext.kernel" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="itext.svg" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="itext.io" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="itext.forms" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime> 

No PDF file is generated.

If not edit the web.config file the PDF file is correctly generated

But why the web.config file continue to use the version 7.1.13.0 of iText 7?

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
    <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
        <add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="Office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="MySql.Data, Version=8.0.18.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
      </assemblies>
    </compilation>
    <httpRuntime maxRequestLength="15360" />

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages>

    <authentication mode="Windows" />
    <identity impersonate="false" />
    <authorization>
      <deny users="?" />
    </authorization>

  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="50000000" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />  
  <security>
   <requestFiltering>
     <fileExtensions>
       <remove fileExtension=".cshtml" />
       <add fileExtension=".cshtml" allowed="true" />
     </fileExtensions>
    </requestFiltering>
  </security>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=8" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>  
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="itext.styledxmlparser" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="itext.layout" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="itext.kernel" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="itext.svg" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="itext.io" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="itext.forms" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-7.1.13.0" newVersion="7.1.13.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>   
</configuration>

 

Posted 13 days ago

Hi comunidadmexi...,

No need to delete the setting or modify manually from web.config.

You need to open the nuget and update the iText7 version only.

This will automatically updated the web config and packages config version.