ExcelDNA Pack error

Feb 20, 2013 at 5:17 PM
Hi,
I am trying to pack an xll that depends on 2 other libraries. All the dlls are in the bin/Release folder and the project builds fine.

I have added the following to the PANEX.dna file
<ExternalLibrary Path="PANEX.dll" Pack ="true"/>
<Reference Path ="PANIC.dll" Pack ="true"/>
<Reference Path ="MyLib.dll" Pack ="true"/>


PANEX contains the functions exported to Excel, the other two contain other classes that are used in PANEX, but not exported to excel.

When I run DNA Pack it gives me a an unhandled exception when trying to resolve the path for PANEX.dll.

Do I need to run this from the bin/release folder?

Any help would be much appreciated.
Thanks
Coordinator
Feb 20, 2013 at 5:21 PM
Hi Nick,

ExcelDnaPack.exe takes a path to a .dna file as a parameter. That .dna file must be the one in your bin\Release folder, and ExcelDnaPack should then look for the .dlls in the same directory. How are your running it at the moment?

-Govert
Feb 20, 2013 at 5:21 PM
Short answer is yes. Run it from the release folder and it works fine.
Feb 20, 2013 at 5:26 PM
Hi Govert - thanks for your prompt response.
I was running ExcelDNAPack from the distribution folder with a path to my .dna file.
It gave me the unhandled exception.

When I ran it from the Release folder it packed everything up fine, but now the ribbon buttons are not working.

PANEX.dll just contains a method that is run when a button on the ribbon is clicked. This method shows a form that is defined in the PANIC.dll forms application.

It all works fine pre-packing, but when I pack it all up, the ribbon shows up with all the icons, but nothing launches.
Any idea why?
Thanks
Coordinator
Feb 20, 2013 at 5:37 PM
Are you testing the packed add-in in that same directory, with the .dlls still around it? You might rather copy it to an empty directory and then run it (sometimes the assembly resolution does funny it there is bot the real and packed version around).

You might have an extra or mismatched version of ExcelDna.Integration.dll in your output directory. Just delete it (the right version is embedded in the .xll file) and mark the reference as "Copy Local=false".

Can't think of anything else right now...

Regards,
Govert
Feb 21, 2013 at 9:46 AM
Ok - so when I copy the packed xll to its own directory it loads, but the buttons don't work. I will add some simple functions to see if I have access to those.
When I add the other dlls to the new directory (so I have all the dlls and the xll in one place) it works fine.

This seems to be the opposite behaviour to what you describe...
Coordinator
Feb 21, 2013 at 9:50 AM
Perhaps there is some dependency that is not being packed?

Does the output from ExcelDnaPack look correct?

-Govert
Coordinator
Feb 21, 2013 at 9:54 AM
You should also check that the right versions of the .xll and ExcelDna.Integration.dll were used (if you've have different versions on your computer, it can easily go wrong).

If you are using the "RunMacro" approach in the ribbon, you might try to run the macro directly by pressing Alt+F8 and typing the name in.

-Govert
Apr 9, 2013 at 3:15 PM
Hi - I have come back to this problem after a while. After a bit of fiddling I managed to get everything set up ok and the pack utility worked fine - there was a dependency not being resolved.

However, one of the applications launched through the Ribbon now relies on the System.Data.SQLite.dll. I am using the mixed mode assembly version of the dll, but this apparently cannot be packed - do you know how I could resolve this issue?

I can see there are options to use native versions of the SQLite dll, but I am struggling to get these to work (mainly due to some issue with System.Data.SQLite.Interop.dll)

Anyway - any help here would be much appreciated.
Thanks.
Coordinator
Apr 9, 2013 at 3:39 PM
Hi Nick,

I'm glad it's working better. Mixed and native assemblies can't be packed at the moment. It would need a bit of work from my side - they have to be written to the file system and managed from there, which is a bit unpleasant.

You might look into the purely managed csharp-sqlite project: https://code.google.com/p/csharp-sqlite/

I'll add the issue to the to-do list.

-Govert
Feb 5, 2015 at 9:31 PM
I am trying to package a project into a single XLL; however, I am getting the error "The parameter is incorrect at ResouceHelper.ResourceUpdater.RemoveResource". I've tried using the Release folder of the project as the source folder and call the ExcelDnaPack.EXE from the ExcelDNA\Distribution folder and also copying the project output into the ExcelDNA\Distribution folder. Either way I get the same error. For starters I am only specifying the DNA path so I have no idea what could be wrong. BTW, I downloaded the ExcelDNA files back in June 2014. Any help will be appreciated. Thanks in advance.
Coordinator
Feb 6, 2015 at 7:07 AM
Does it work when you try to pack the sample ExcelDna.dna file that is in the Distribution directory?

It's not an error I remember hearing of before.

-Govert
Feb 6, 2015 at 3:59 PM
Edited Feb 6, 2015 at 5:15 PM
Yes, packing the ExcelDNA sample does work. I must be missing something but I cannot figure out what it could be. The project works fine using the suite of files (i.e. XLL, DNA, and DLL files) but when trying to pack them, I cannot get there. I do not consider this project to be a complex one (this is a lot simpler than the one coming next) but not been able to pack it puts a burden on it. For now, I will send the test users the whole suite so they can start testing and when I figure out how to pack it, then I will deploy the final version. BTW, I ran the Packing tool under debug and it is failing on ru.RemoveResource("ASSEMBLY", "EXCELDNA.INTEGRATION") line 145 if that helps. I could also send you the suite of files if you want (approx. 500kB).
Feb 8, 2015 at 5:33 PM
Govert,

SUCCESS! I took the liberty of changing the ExcelDNAPack code and now it works like a charm. Perhaps this is something that you have done already and I do not have the latest but I simply added a test for the EXCELDNA.INTEGRATION resource before trying to remove it (i.e. a call to FindResource). I am not sure if the resource is supposed to be part of the XLL by default but in my case that resource was not there and thus the RemoveResource call was failing. By adding the test, I skipped the Exception throw and life is good again. Please let me know if I am playing with fire here.

Thanks in advance.
Coordinator
Feb 9, 2015 at 9:00 AM
The .xll files distributed with Excel-DNA always have the integration library embedded. I'm not sure where your copy might come from - maybe a previous run of the ExcelDnaPack that failed half-way.

Your workaround should not be needed for a normal installation, but should not cause any harm.

-Govert
Feb 9, 2015 at 12:54 PM
Hmm, thanks Govert. I do not recall messing around with the base XLL so I am not sure why it does not contain the embedded assembly. Even if a previous pack run had failed, I would have expected the removal to be done to the copy ("-packed") and not the original. But then again, the problem is solved for me. Thanks once again.


Sent from my Verizon Wireless 4G LTE smartphone