Version of iText 7 conflict on the same solution C# (.NET)

0

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

enter image description here

In the folder package of solution

enter image description here

There is an old folder named itext7.7.1.3 that which I renamed itext7.7.1.3_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?

If exclude on web.config file this part

<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>

I have this error..

Could not load file or assembly 'itext.styledxmlparser, Version = 7.1.3.0, Culture = neutral, PublicKeyToken = 8354ae6d2174ddca' or one of its dependencies could not be loaded. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

<?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>

project file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "aspnet", "C:\inetpub\wwwroot\aspnet\", "{CF862A09-7B36-4D4B-894B-7D4978055A26}"
    ProjectSection(WebsiteProperties) = preProject
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
        Debug.AspNetCompiler.VirtualPath = "/localhost_61437"
        Debug.AspNetCompiler.PhysicalPath = "C:\inetpub\wwwroot\aspnet\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_61437\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "false"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/localhost_61437"
        Release.AspNetCompiler.PhysicalPath = "C:\inetpub\wwwroot\aspnet\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_61437\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = "true"
        Release.AspNetCompiler.FixedNames = "false"
        Release.AspNetCompiler.Debug = "False"
        VWDPort = "61437"
    EndProjectSection
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {CF862A09-7B36-4D4B-894B-7D4978055A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {CF862A09-7B36-4D4B-894B-7D4978055A26}.Debug|Any CPU.Build.0 = Debug|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {FD49268C-9C4A-4AC8-9001-1404CEBEC951}
    EndGlobalSection
EndGlobal
c#
asp.net
pdf
web-config
itext7
asked on Stack Overflow Feb 22, 2021 by Edward Sheriff Curtis • edited Feb 22, 2021 by Edward Sheriff Curtis

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0