首页 > 解决方案 > Diagnostic display apear on open the add-in

问题描述

We have the add-in to excel written in C#. We are using Excel-DNA also. Lately we got this window on startup of Add-in enter image description here

Any idea what is this window and how we can turn of it?

标签: c#excelexcel-dna

解决方案


By default, Excel-DNA will try to register all public static methods in public types in the assemblies listed as <ExternalLibrary ...> in the .dna file.

For your add-in, there seems to be more than one such function called 'Modulus' that Excel-DNA is trying to register. The error arises from this duplication (one registration is being overwritten by another).

You have a few ways around this:

  • Make sure you only have one 'Modulus' function being registered, either by making one of the methods not public, or enabling 'ExplictExports=true' in your .dna file and marking all functions with ExcelFunction attributes.
  • Make sure you don't have additional libraries set up as <ExternalLibrary> in the .dna file - extra assemblies that you want to pack into a single-file .xll should be added as <Reference> tags - these are not examined for functions and registered with Excel.
  • You can control how the logging works, and thus prevent the error window from showing, by customising the logging settings in the .xll.config file - see https://github.com/Excel-DNA/ExcelDna/wiki/Diagnostic-Logging.

推荐阅读