9
votes

I am .net coder and I am really really new to ColdFusion. I wrote a .dll library which automatically generates an invoice. I needed to use the library from a ColdFusion application. I have successfully loaded the classes in my library as coldfusion objects as I can call the methods. However, there is one method in my class which uses WordprocessingDocument which is a class of DocumentFormat.OpenXml.Packaging. I am actually getting this error :

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

I have imported the DocumentFormat.OpenXml.dll so is the WindowsBase.dll files

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

I need your guidance to what am I doing wrong or what am I missing here?

1
ooh thanks to that Leigh! Yeah, that looks a lot better now :)jmesolomon
Welcome :) Unfortunately, I do not have an answer, but did you check the jnbridge (used for .net interop) logs? See {cf_install}/jnbridge/error.log. Sometimes that log contain additional details about .net errors.Leigh
No, I have not yet. I'll try it now. I've been stuck on this problem for quite a while now. Sucks balls! I could call methods in .dll library successfully, but this particular method which implements WordprocessingDocument class is where it fails. I'm sure I've included all dependencies. Could it be a class loader issue? Anyways, Thank you for your suggestion, I'll check right awayjmesolomon
Did you include all of the dependencies with every createObject call? Omitting a few might cause that problem. Could it be a class loader issue Possibly, that is sometimes the cause of "method not found .." errors, but it is hard to say.Leigh
If you are feeling adventurous, you might try generating the proxies yourself with built in tools in \jnbridge directory. Also, in case it is relevant what is your full CF version? Check the CF Admin screen or use <cfdump var="#server.coldfusion#">Leigh

1 Answers

0
votes

Use a tool like dependency walker to make sure you are copying all of the required linked dlls that DocumentFormat.OpenXml.dll is using. Also do not forget to copy this file with your output.