Open govert opened 4 years ago
I like the MinimumFrameworkVersion
attribute idea. It feels like a natural extension of the .dna
spec. We would default to v4.5 if the attribute is not present, and easily maintain compatibility with existing .dna
files. Seems like the easiest path forward.
Another idea would be to go on a slightly different route and honor the supportedRuntime
in the AddIn.xll.config
instead.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
The first looks more exceldna-y whilst the second looks more dotnet-y.
Probably not worth the effort, I think, given App.config
won't be a thing in .NET 5 (replaced by appsettings.json
).
Something we could also consider would be detecting the target framework during the build and automatically add or replace the MinimumFrameworkVersion
in the output .dna
file, so it would always do the right thing on behalf of the developer, even when they change their project to target a different version of the .NET Framework.
Alternatively, and thinking of a future where .dna files don't exist anymore (or are 100% auto-generated) and everything is driven from settings in the project file (SDK-style), we could detect the target framework during the build and stamp the .xll
files with an attribute that describes the minimum framework required, similar to how ExcelDnaPack stamps -packed.xll
files with the version number.
ps: In the short-term it makes sense to update the .dna
XSD schema to only allow v4.0
in RuntimeVersion
moving forward. I'll send a PR.
Related link: Detect .NET Framework 4.5 and later versions
Figure out and implement a plan for dealing with the supported framework versions, especially now that Excel-DNA itself does not support .NET Framework 4.0 anymore. The framework version is different to the runtime version, so I think we need a separate attribute in the .dna file:
We'll keep RuntimeVersion in place for now, although the only supported value is currently "v4.0", imagining a future where "v5" makes sense.