2014-10-07 291 views
9

我是.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

回答

0

使用像dependency walker這樣的工具來確保您正在複製DocumentFormat.OpenXml.dll正在使用的所有必需的鏈接dll。另外不要忘記複製這個文件與你的輸出。

相關問題