Coldfusion OpenXml错误:无法加载文件或程序集'DocumentFormat.OpenXml'

问题描述:

我是.net编码器,我对ColdFusion真的很陌生。我写了一个自动生成发票的.dll库。我需要使用ColdFusion应用程序的库。我已经成功地将我的库中的类作为coldfusion对象加载,因为我可以调用这些方法。但是,在我的类中有一个使用WordProcessingDocument的方法,它是DocumentFormat.OpenXml.Packaging的一个类。其实我得到这个错误:Coldfusion OpenXml错误:无法加载文件或程序集'DocumentFormat.OpenXml'

System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at InvoiceLibrary.DocumentHandler.ConvertDocumentToDOCX(String file)
at InvoiceLibrary.DocumentHandler.ProcessDocument()

我已导入DocumentFormat.OpenXml.dll所以是WindowsBase.dll中的文件

<cfObject type=".NET" name="WordprocessingDocument" 
    class="DocumentFormat.OpenXml.Packaging.WordprocessingDocument" 
    assembly="C:\Users\mydocs\Documents\Visual Studio 2012\Projects\InvoiceGenerator\InvoiceLibrary\bin\Release\DocumentFormat.OpenXml.dll,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll"> 

我需要你的指导,我究竟做错了还是什么是我错过了吗?

+1

哦,感谢那个Leigh!是的,现在看起来好多了:) – jmesolomon 2014-10-07 03:17:20

+0

欢迎:)不幸的是,我没有答案,但是您检查了jnbridge(用于.net interop)日志吗?请参阅'{cf_install}/jnbridge/error.log'。 *有时*该日志包含有关.net错误的其他详细信息。 – Leigh 2014-10-07 18:20:07

+0

不,我还没有。我现在就试一试。我一直在这个问题上停留了很长一段时间。吮吸球!我可以成功调用.dll库中的方法,但是实现WordprocessingDocument类的这种特殊方法是失败的地方。我相信我已经包含了所有的依赖关系。它可能是一个类加载器的问题?无论如何,感谢您的建议,我会立即检查 – jmesolomon 2014-10-07 18:58:46

使用像dependency walker这样的工具来确保您正在复制DocumentFormat.OpenXml.dll正在使用的所有必需的链接dll。另外不要忘记复制这个文件与你的输出。