BenchmarkDotNet
BenchmarkDotNet copied to clipboard
Add support for `runtimeconfig.template.json`
If I add RuntimeHostConfigurationOption to the benchmark project like this:
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
</ItemGroup>
The built project will have this added to [appname].runtimeconfig.json:
{
"runtimeOptions": {
"configProperties": {
"System.Runtime.Loader.UseRidGraph": true
}
}
}
This is important to be able to deal with this breaking change in .NET 8:
https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list#recommended-action
However, the generated project does not copy this setting over, so the resulting project will not get the correct value injected into its runtimeconfig.json.
An alternative way is to add a runtimeconfig.template.json file with the above json, but again, the generated project will not pick this up.
Perhaps https://github.com/dotnet/BenchmarkDotNet/blob/ece5ccfc91d92b610338b05da73d2a91508e2837/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs#L26 needs RuntimeHostConfigurationOption added, and also a way to make sure runtimeconfig.template.json files are copied as well.
Reopening for someone to add support for runtimeconfig.template.json.