FileNotFoundException

Jul 24, 2012 at 10:50 AM

I'm trying to use the latest versions (75641) and I'm tripping over a FileNotFoundException when I start Excel. 

Could not load ...'ExcelDna.Loader' or one of its dependencies...

Initially I assumed this was because RX was not referenced.  I added this without affecting this issue.  So do I need to reference RX and if so which version?

I am also using ArrayResizer and hence ExcelAsyncUtil.  I realize I need to call Initialise/Unitialise which I'm not and this might be the issue.  But I just explicitly export a limited number of methods from an external lib and don't have an addin as such.  Do I need to create an 'addin'?  How should I attribute it?

Regards

Andy

 

Coordinator
Jul 24, 2012 at 12:17 PM

Hi Andy,

You're getting an unusual error. I suggest we backtrack a bit...

1. If you just double-click the Distribution\ExcelDna.xll, does it open and make an =AddThem(...) function available in your Excel?

2. When you get the ExcelDna.Loader error, could you perhaps have a mismatched version of ExcelDna.Integration and ExcelDna.xll in your output directory? You don't actually need ExcelDna.Integration.dll in your output directory or to redistribute it. The easiest is to set the reference to ExcelDna.Integration.dll as "Copy Local = false".

I suggest you get everything working without the ArrayResizer first.

For the ArrayResizer you need to call ExcelAsyncUtil.Initialize() from a macro context. Easiest is just to define a class in your project that implements the IExcelAddIn interface, and then put the call to ExcelAsyncUtil.Initialize() in the AutoOpen().

An Excel-DNA "Add-In" is the combination of your renamed copy of ExcelDna.xll (maybe called MyCoolAddIn.xll), a MyCoolAddIn.dna file and any .dlls you might need.

There is no dependency on the Rx libraries for the basic Excel-DNA version, but if you want to use the RxExcel example then you need to reference some Rx libraries. So just to export some functions, and even use the Resizer, you need no reference to Rx.

Regards,

Govert

Jul 24, 2012 at 1:17 PM

1. Yes

2. Googling led me down the path of building 75641 and adding ExcelDna.Loader.dll to the output.  Now it works... Now the FileNotFoundException is not found...

3. ArrayResizer

Here is my dan function:

        [ExcelFunction(Category = "xxxxxxx",
                       Description = "stuff",
                       IsExceptionSafe = false,
                       IsHidden = false,
                       IsMacroType = false,
                       IsThreadSafe = true,
                       IsVolatile = false,
                       Name = "GetDataTypes"
                      )]
        public static object GetDataTypes()
        {
            var data = new string[] { "P", "N", "L" };

            //return data;
            return XlCall.Excel(XlCall.xlUDF, "Resize", data);
        }

Creating an array larger than the output yields an unresized array of #VALUE!

 

 

Coordinator
Jul 24, 2012 at 1:52 PM

Hi Andy,

Copying a recompiled copy of ExcelDna.Loader.dll into the output might work, but it is a bad idea and not the right way to solve your problem. Excel-DNA expects to load that file from the embedded copy inside ExcelDna.xll. I suggest you try to make it work without ExcelDna.Loader.dll and ExcelDna.Integration.dll in the output directory. When recompiling from source, be sure to 'rebuild all", and check that

  • the resulting .xll file together with the Distribution\ExcelDna.xll alone in a directory still works, and 
  • that you are referencing and using matching copies of ExcelDna.Integration.dll and ExcelDna.xll.

ArrayResizer - your resizing function cannot be marked as IsThreadSafe =true. With IsThreadSafe=false it works on my machine.

-Govert

 

 

Jul 24, 2012 at 2:07 PM

ArrayResizer...superb

I will revisit the ExcelDna.Loader issue tomorrow.  Need to deliver some product with ExcelDna asap...

 

Thanks

Andy

Nov 13, 2012 at 1:59 PM

I've get the same exception with 64-bit version of ExcelDNA and project with x86 target platform )

Coordinator
Nov 13, 2012 at 2:07 PM

If your project targets the x86 platform it cannot be loaded into the 64-bit Excel process.

So when your library is being loaded by Excel-DNA there will be an exception like this.

-Govert