dotnet / dotnet/BenchmarkDotNet

Add support for `runtimeconfig.template.json`

Open
#2,428 3 comments 0 reactions 0 assignees View on GitHub
Area:Toolchains up-for-grabs
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
4d 11h
Merged PRs (30d)
11

Description

If I add RuntimeHostConfigurationOption to the benchmark project like this:
```xml



```
The built project will have this added to [appname].runtimeconfig.json:
```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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.