Re: How to stop Excel DNA exposing all Public Static methods as Excel functions?

453 views
Skip to first unread message

Govert van Drimmelen

unread,
Jul 10, 2012, 11:58:06 AM7/10/12
to Excel-DNA
Hi Ian,

This is exactly what the ExplicitExports attribute is for. You need to
set this in your ExternalLibrary tag:


<DnaLibrary Name="My AddIn" RuntimeVersion="v4.0" >
<ExternalLibrary Path="MyAddIn.dll" ExplicitExports="true" />
<ExternalLibrary Path="SomeExtraFunctions.dll"
ExplicitExports="true" />
</DnaLibrary>


The part you see commented out in the code is that we don't allow the
ExplicitExports to be set in the root DnaLibrary tag.

Regards,
Govert


On Jul 10, 5:32 pm, kutabale <ilirsul...@gmail.com> wrote:
> Well the easiest is if you open  resx  and change access modifier to
> internal. I think ExcelDna wont be able to find the strings.
>
>
>
>
>
>
>
> On Tuesday, July 10, 2012 9:46:34 AM UTC-4, Ian Clegg wrote:
> > Hi folks,
>
> > I have an XLL containing localised string resources for
> > various European languages using standard 'resx' files. The .net resx
> > compiler generates strong types for accessing those localised strings, and
> > these are public classes with static getters/setters. This is the appears
> > to be the behaviour for .NET resx files and cannot be disabled.
> > The problem I have is that during AssemblyLoader.ProcessAssemblies() and
> > then GetExcelMethods() Excel DNA appears to be use reflection to locate all
> > Public Static types and export them as Excel functions. This causes my
> > localised string resources to appear as functions. It looks like I could
> > use explicitExports, but this does not appear to apply to compiled binaries
> > - the code is commented out for setting it.
> > It looks like my only option may be to move all my localised resources
> > into a new assembly to avoid this problem, but before I do. Is there anyway
> > to exclude or include specific functions as being exported to Excel. I
> > thought this was the reason for using attributes, but Excel DNA seems to
> > take public static method?
>
> > Thanks
> > ian
Reply all
Reply to author
Forward
0 new messages