VS 2017 C#打印.rpt(晶体报表)FileNotFoundException“ CrystalDecisions.ReportAppServer.CommLayer,版本= 13.0.2000.0”

时间:2018-11-02 09:01:24

标签: c# visual-studio crystal-reports

我尝试将.rpt文件打印到打印机上。我安装了Crystal Report Engine,并将CrystalDecisions.ReportAppServer.CommLayer.dll添加到了我的项目中。

enter image description here

            string rptFileName = @"C:\Users\User99\Desktop\Kommissionierliste.rpt";
            string PrinterName = "Canon MX490 series Printer";

            ReportDocument reportDocument = new ReportDocument();
            reportDocument.Load(rptFileName);
            PrinterSettings printerSettings = new PrinterSettings();
            printerSettings.PrinterName = PrinterName;
            reportDocument.PrintToPrinter(printerSettings, new PageSettings(), false);

运行代码时出现错误,告诉我找不到文件。我认为它仍在寻找错误的版本(正在寻找13.0.2000.0,但我已经拥有13.0.3500.0)。

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedruntime version="v4.0" sku=".netframework,version=v4.0"/>
  </startup>
  <runtime>
    <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.crystalreports.engine" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportsource" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.shared" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.web" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.windows.forms" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.clientdoc" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.commoncontrols" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.commonobjectmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.controllers" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.cubedefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.datadefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.datasetconversion" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.objectfactory" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.prompting" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.reportdefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="crystaldecisions.reportappserver.xmlserialize" publickeytoken="692fbea5521e1304" culture="neutral"/>
        <bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
      </dependentassembly>
    </assemblybinding>
  </runtime>
</configuration>

0 个答案:

没有答案