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.
Add a project property <ExcelAddInCustomRuntimeConfiguration> with default false.
If set, the build should
Add a CustomRuntimeConfiguration attribute to the DnaLibrary tag in the .dna file we create (either just true/false or a name?)
During packing, pack the .runtimeconfig.json as a resource.
When loading the runtime, check if CustomRuntimeConfiguration is set in the .dna file. If so
if there is a runtimeconfig.json as a resource in the .xll, extract this file and use it when loading the runtime.
if there is no runtimeconfig.json in resources, (for example we are running the unpacked add-in), but there is a loose runtimeconfig.json (maybe check name here) then use this <projectname>.runtimeconfig.json when starting the runtime. This means normal debugging which uses the not-yet-packed library should use the custom runtimeconfig. Similarly <ExcelDnaUnpack>true</ExcelDnaUnpack> should leave us with an add-in that loads the custom runtimeconfig.json.
(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.
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.
<ExcelAddInCustomRuntimeConfiguration>
with default false.CustomRuntimeConfiguration
attribute to theDnaLibrary
tag in the .dna file we create (either just true/false or a name?)CustomRuntimeConfiguration
is set in the .dna file. If so<projectname>.runtimeconfig.json
when starting the runtime. This means normal debugging which uses the not-yet-packed library should use the custom runtimeconfig. Similarly<ExcelDnaUnpack>true</ExcelDnaUnpack>
should leave us with an add-in that loads the custom runtimeconfig.json.(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.