What version of Excel are you using?
If it is Excel 2010, then what you call ‘caching’ might be a consequence of an Excel bug, where the RTD topic is not properly disconnected.
The bug is fixed in Excel 2010 SP1 and there is a workaround in the upcoming Excel-DNA version 0.33.
-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 http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.
Excel-DNA v 0.33 should not break anything.
You can either update to the pre-release NuGet package, or download the release candidate from GitHub: https://github.com/Excel-DNA/ExcelDna/releases/tag/v0.33.7-rc1.
That’s an interesting breaking change that I did not know about.
In the past I used the trick of deriving from XlCall to get rid of the class qualifiers on the static calls (like Excel(xlfCaller)).
I’ve marked the XlCall class as “public static” to enable the new C# 6.0 using static feature.
So if you’re using Visual Studio 2015, you’ll be able to say:
using static ExcelDna.Integration.XlCall;
and then remove the derivation from XlCall, and everything should compile.
If you’re not using Visual Studio 2015, you have to change the Excel calls to XlCall.Excel, and xlfCaller to XlCall.xlfCeller etc.
I’ll have to think about this a bit – it’s not a breaking change I know about or would like to leave in for the release, so something will have to change.
OK – I see what happened.
The preview version of C# 6.0 required that the class be declared as “static” for the new “using static” feature to be used. That’s why I changed the XlCall class to “static”.
But in the release version of C# 6.0, the class is no longer required to be “static”, so I will remove this modifier from the XlCall class again.
So the release version of Excel-DNA v 0.33 will not have the problem you report.
Thank you for finding this!
...
Hi Manoj,
Can you explain a bit more about your configuration? (In particular, what does your .dna file look like?)
I think what you see is ‘by design’.
By default, Excel-DNA looks at all the <ExternalLibrary …/> tags in the .dna file, and in each of those assemblies, it exports all public static methods with compatible signatures. (Note that assemblies added as <Reference ../> assemblies are not exported).
The messages you see indicate that you have different classes declaring a public static method called ToString / DisplayErrorTemplateMessage / Check.
In the past they’d all be registered with Excel, but only the last one registered would ‘win’ and be used.
This is unlikely to be what you wanted - probably these methods should all be ‘internal’.
Does that agree with what you see in your code?
You can also control exactly what methods get registered by setting the ExplicitExports tag in the .dna file:
<DnaLibrary Name="Test Add-in" RuntimeVersion="v4.0">
<ExternalLibrary Path="TheLibrary.dll" ExplicitExports="true" />
</DnaLibrary>
Then only functions explicitly marked with an [ExcelFunction] attribute will be exported.
I think showing the Error in this case is an improvement, because it highlights a confusion. Also, it appears immediately and consistently for your add-in, so you can deal with it when upgrading – it’s not a change that will only appear at runtime.
What do you think?
--
...
I think you actually want the .dna file to look like this:
<DnaLibrary Name="Myaddinname" RuntimeVersion="v4.0">
<ExternalLibrary Path="AddinUDF.dll" LoadFromBytes="true" Pack="true" ExplicitExports="true” />
<Reference Path="MyService.dll" LoadFromBytes="true" Pack="true" />
<Reference Path="Myentiites.dll" LoadFromBytes="true" Pack="true" />
<Reference Path="Shared.dll" LoadFromBytes="true" Pack="true" />
</DnaLibrary>
Only the library that has the UDFs should be an ExternalLibrary, all the others are just Reference libraries.
--
...
I presume you mean this function:
[ExcelFunction(Name = "MyTest", Description = "MyTest", Category = "MyTest", IsMacroType = true)]
public static object[,] MyTestFunction(
[ExcelArgument(AllowReference = false, Name = columnName1, Description = columnName1)] object columnName1,
[ExcelArgument(AllowReference = true, Name = columnName1, Description = columnName1)] object columnName2,
[ExcelArgument(Name = columnName3, Description = columnName3)] bool columnName3,
[ExcelArgument(Name = columnName4, Description = columnName4)] bool columnName4)
{ …}
Excel considers the function as volatile by default, since you have both marked the function with IsMacroType=true and have an argument marked AllowReference=true.
Do you need the reference for columnName2, or can you replace with an object[,] parameter to just get the values?
--
...
Any work around for this.or any alternative for excelaysncutil.run()