Comments (5)
ExplicitExports
should definitely be 'false' by default and should be 'false' in the .dna template by default - this makes the VB situation friendlier, and is compatible with the past.
However, I'm happy to have the template in the NuGet package include both the ExplicitExport='false'
tag, and a comment that describes the situation. So anything like this:
<DnaLibrary Name="%ProjectName% Add-In" RuntimeVersion="v4.0">
<ExternalLibrary Path="%OutputFileName%" LoadFromBytes="true" Pack="true" ExplicitExports="false" />
<!-- ExplicitExport indicates whether exported function and macros need to be explicitly marked with [ExcelFunction(...)] and [ExcelCommand(...)] macros to be exported, or whether all public static methods with compatible signature are registered.
The behavior is as follows: .....
Read more here:....
-->
</DnaLibrary>
from exceldna.
@govert: Could you expand on the "makes the VB situation friendlier" part? Is there a difference between C# and VB with regards to the exports of functions?
Adding the attribute to the .dna template, even if false
by default, seems like a step in the right direction to me, so 👍.
I do, however, think would be nice to go a little bit further and - at least - declare it as true
for newly created add-ins, and thus still staying compatible with existing add-ins.
from exceldna.
I mean for somebody coming from VBA, it's pretty cool that the basic code can look like this
Public Module MyFunctions
Function AddThem(v1, v2)
AddThem = v1 + v2
End Function
End Module
It's bad enough that you need the Public Module ...
around it, but at least you don't need to know about attributes to get started.
I value that enough, together with the backward compatibility, to want to keep the default 'false'.
from exceldna.
Got it.
I see your point re: simplicity, but I honestly question if that is "real code" vs "demo code".
I've never seen a real-world add-in that simple, where every function is self-contained and don't call other utility functions to get some reuse.
As soon as you get into something almost as simple:
Public Module MyFunctions
Function Calculate(v1, calcType)
denominator = GetDenominator(calcType)
Calculate = v1 / denominator
End Function
Function GetDenominator(calcType)
Case calcType = "x"
GetDenominator = 10
Case calcType = "y"
GetDenominator = 20
Default
GetDenominator = 1
End Function
End Module
You're in trouble... As GetDenominator
now is exposed to the world and your public API surface is bigger than you wanted it to be - and by the time you notice it, it could be too late and people are already using GetDenominator
in their spreadsheets.
Now imagine you have 50 methods that got exposed unintentionally, instead of one... 50 more methods to support / keep backwards compatibility, etc. than you originally planned for.
So in general, I think being explicit on what you make public to the user, leads to a better design.
Anyway, having the attribute in the template is still a good improvement.
from exceldna.
Check-in 37326da adds the ExplicitExports="false" to the .dna file template.
from exceldna.
Related Issues (20)
- XlCall.Excel(XlCall.xlSheetNm, reference) replaces box brackets with round brackets HOT 2
- Risky use of ConcurrentDictionary HOT 3
- Assertion Failed on users machine HOT 8
- Allow use of ExcelReference from outside Excel context
- Question: addin size HOT 21
- ExcelDNA get file name
- -packed.xll not generated HOT 1
- Unable to build project with latest release HOT 1
- Registration [Error] xlfRegister call failed for function or command HOT 3
- Attack surface reduction block triggered in corporate environment HOT 1
- Could not load file or assembly 'System.Reflection.Metadata HOT 1
- Error value on multiple calls to a ThreadSafe async function HOT 7
- FrameworkReference issue with xll (.NET 6) HOT 3
- How much money is needed to make it .net 8 compatible? HOT 1
- How to access Microsoft.Office.Interop.Excel component from IRibbonControl HOT 2
- Use runtimeconfig.json when loading runtime - ASP.NET Core support under .NET 6+
- RunExcelDnaSetDebuggerOptions: open Excel file at launch HOT 2
- native runtime library is not found when packed. HOT 3
- Support packing a .chm help file
- how to use webview2 in CustomTaskPane with ExcelDna project? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exceldna.