Confused about the packing process

377 views
Skip to first unread message

Robert Goodman

unread,
Oct 17, 2016, 4:35:44 PM10/17/16
to Excel-DNA
I've got class with some functions that I'm trying to get ready for deployment. I'd like to pack in the required dlls (such as the Intellisense dll) so that there are no dependencies for the user to worry about. Here's what I don't understand:

I have a reference path added to my .DNA file
<DnaLibrary Name="AVAFinancialTools Add-In" RuntimeVersion="v4.0">
  <ExternalLibrary Path="AVAFinancialTools.dll" LoadFromBytes="true" Pack="true" />
  <Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
</DnaLibrary>


When I do the standard compile, it creates a dll ending in -AddIn-packed. I've tried it, but Intellisense still doesn't work unless I add in that separate Intellisense dll in excel. I've also tried using ExcelDnaPack.exe, but it gives me this error:

System.ComponentModel.Win32Exception: The parameter is incorrect
   at
ResourceHelper.ResourceUpdater.RemoveResource(String typeName, String name)
   at
ExcelDnaPack.PackProgram.Pack(String[] args)
   at
ExcelDnaPack.PackProgram.Main(String[] args)


Should I be using ExcelDnaPack, or is the standard build ok? What am I doing wrong that's preventing my dll from being bundled in?

Govert van Drimmelen

unread,
Oct 17, 2016, 11:28:56 PM10/17/16
to exce...@googlegroups.com
Hi Robert,

Your .dna file looks right, so I'm not sure what's going wrong.

The error you see when running ExcelDnaPack yourself looks like a problem, though the message rings a bell and I've seen it before somewhere. It makes me think there is something wrong with the references or versions of ExcelDna.xll you're using.

Does the same error message appear in the normal build output window too?

As a first step, I suggest trying a completely fresh project:
* Create a new class library project.
* Install the ExcelDna.AddIn package
* Install the ExcelDna.Intellisense package
* Add a function, add the IntelliSenseServer install code and fix the .dna file.

Does it work with the packed add-in then?

If not, I'll review the steps again on my side, and see what we can look for next.

-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Robert Goodman

unread,
Oct 18, 2016, 5:12:46 PM10/18/16
to Excel-DNA
I stand corrected. I thought it worked, but when I try moving AVAToolkit-AddIn-packed.dll to someone else's machine the function works but Intellisense doesn't. Can I have a few ideas of things to try?

Robert Goodman

unread,
Oct 18, 2016, 5:12:46 PM10/18/16
to Excel-DNA
Got it! Turned out not to be packing related after all. I wasn't properly setting up the Intellisense server.

Govert van Drimmelen

unread,
Oct 18, 2016, 5:55:25 PM10/18/16
to exce...@googlegroups.com
What version of Excel do they have?

-Govert

On 18 Oct 2016, at 23:14, Robert Goodman <rjgo...@gmail.com> wrote:

I stand corrected. I thought it worked, but when I try moving AVAToolkit-AddIn-packed.dll to someone else's machine the function works but Intellisense doesn't. Can I have a few ideas of things to try?

--
Message has been deleted

Robert Goodman

unread,
Oct 19, 2016, 9:19:22 AM10/19/16
to Excel-DNA
2010, Same as on my development machine.

Robert Goodman

unread,
Oct 24, 2016, 3:07:19 PM10/24/16
to Excel-DNA
Govert, have you been able to think of any ideas on fixing this? I've been fiddling with it and I'm still stumped. It's the same version of excel on their machine and mine, so I'm not sure why it's working for me and not them.


On Tuesday, October 18, 2016 at 5:55:25 PM UTC-4, Govert van Drimmelen wrote:

Govert van Drimmelen

unread,
Oct 24, 2016, 3:25:32 PM10/24/16
to exce...@googlegroups.com
What is different between the machines - Windows version, security software etc.?
Does a simpler add-in work, e.g without packing?
Do other aspects of the add-in work?
Have you switched on logging in the .config file?

-Govert

Robert Goodman

unread,
Oct 27, 2016, 2:35:43 PM10/27/16
to Excel-DNA
What is different between the machines:

Both PC's are Windows 7 Pro, service pack 1, with Norton security. The only difference I can think of is that mine has Visual Studio, so maybe there's some library installed on my machine that isn't on the other?

Does a simpler add-in work, e.g without packing? Do other aspects of the add-in work?
The rest of the addon works just fine. It's only the Intellisense functionality that isn't working. 

Have you switched on logging in the .config file?
The docs were a bit confusing on this..would I need to install something like nLog on the production machine? If possible I'd like to install as little as possible on their PC.

Govert van Drimmelen

unread,
Oct 27, 2016, 5:21:22 PM10/27/16
to Excel-DNA
Hi Robert,

I missed this earlier, but for the IntelliSense packing you need some extra files in the .dna file.
This is the example from the detailed Usage Instructions for the IntelliSense extension on GitHub: https://github.com/Excel-DNA/IntelliSense/wiki/Usage-Instructions

<DnaLibrary Name="IntelliTest Add-In" RuntimeVersion="v4.0">
  <ExternalLibrary Path="IntelliTest.dll" LoadFromBytes="true" Pack="true" />

  <Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
  <Reference Path="UIAComWrapper.dll" Pack="true" />
  <Reference Path="Interop.UIAutomationClient.dll" Pack="true" />
</DnaLibrary>
I suspect the extra files have been installed in the GAC on your machine (perhaps by Visual Studio) but might not be on the other machine.
Could you try to add these, then rebuild the packed add-in and check again?

Thanks,
Govert

Robert Goodman

unread,
Oct 28, 2016, 2:10:40 PM10/28/16
to Excel-DNA
That did it! Thanks! In case anyone else has the same problem, I've put below the completed test function and dna files that solve the problem.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExcelDna.Integration;
using ExcelDna.IntelliSense;

namespace AVAToolkit
{
    public class MainToolkit : IExcelAddIn
    {

        public void AutoOpen()
        {

            IntelliSenseServer.Register();

        }



        public void AutoClose()
        {

        }

        [ExcelFunction(Description = "My first .NET function")]
        public static string HelloDnaWithIntellisense(
            [ExcelArgument(Name = "nameVar", Description = "A name parameter")]
            string name)
        {
            return "Hello " + name;
        }
    }
}


<DnaLibrary Name="AVAToolkit Add-In" RuntimeVersion="v4.0">
  <ExternalLibrary Path="AVAToolkit.dll" LoadFromBytes="true" Pack="true" />
  <Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
  <Reference Path="UIAComWrapper.dll" Pack="true" />
  <Reference Path="Interop.UIAutomationClient.dll" Pack="true" />
</DnaLibrary>

Reply all
Reply to author
Forward
0 new messages