PDFLibNet第三方库中我在.net framework2中可以运行,我把它放到.net framework中就出现错误:
  混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集
怎么才能让它可以再.net framework中也可以运行啊!C#.netPDFLibNet

解决方案 »

  1.   

    不支持。net4呗。
    去找找新版本的。
      

  2.   

    试试:<?xml version="1.0"?>
    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku = ".NETFramework,Version=v4.0"/>
        <supportedRuntime version="v2.0.50727"/>
      </startup>
    </configuration>
      

  3.   

    修改了之后又出现一个新的错误在创建类的一个对象时它错误提示是
       方法实现中引用的声明不能是 final 方法。类型:“PDFLibNet.xPDFBinaryReader”,程序集:“PDFLibNet, Version=1.0.6.6, Culture=neutral, PublicKeyToken=26d87f7d66fb2aee”。这个是什么原因啊!
      

  4.   

    代理类的成员变量要添加virtual 关键字
      

  5.   


    //下载 itextSharp.dll
     
    //下载地址 http://sourceforge.net/projects/itextsharp/
      
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using System.IO;
     
    private void btnExport_Click(object sender, EventArgs e)
    {
    Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
    PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("d:\\Test.pdf", FileMode.Create));
      
    doc.Open();//Open Document to write
      
     
    Paragraph paragraph = new Paragraph("data Exported From DataGridview!");
      
    doc.Add(paragraph);
    doc.Add(t1);
    doc.Close(); //Close document
    //
    MessageBox.Show("PDF Created!");
    }