Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.26k stars 270 forks source link

Use runtimeconfig.json when loading runtime - ASP.NET Core support under .NET 6+ #675

Closed govert closed 3 months ago

govert commented 4 months ago

We should add an option to use the project's output runtimeconfig.json file instead of the default one we currently create when loading the runtime in the Excel-DNA host. A limitation of this options is that it will only apply for the first .NET6+ add-in that is loaded into an Excel process.

(Maybe if CustomRuntimeConfiguration is set, we copy the project output runtimeconfig.json to a file called ExcelDna.Host.runtimeconfig.json, and always use that name for our host? Or we match the .xll name? Or we put the name in the .dna file?)

In particular we want to support having the additional framework for ASP.NET in the project. But other runtimeconfig.json configuration settings would be supported automatically.

Error handling is important, since we anticipate an add-in attempting to load into a process where the runtime has already been loaded, without the extra ASP.NET SDK. In this case we should attempt to give as an informative an error message as possible by dealing with the specific status codes returned.