Skip to content

Update GenerateRuntimeConfigurationFiles task to generate Hot Reload runtime options #53715

Open
tmat wants to merge 2 commits into
dotnet:mainfrom
tmat:GenerateHotReloadPropertiesToRuntimeConfigDev
Open

Update GenerateRuntimeConfigurationFiles task to generate Hot Reload runtime options #53715
tmat wants to merge 2 commits into
dotnet:mainfrom
tmat:GenerateHotReloadPropertiesToRuntimeConfigDev

Conversation

@tmat

@tmat tmat commented Apr 6, 2026

Copy link
Copy Markdown
Member

Update GenerateRuntimeConfigurationFiles task to generate Hot Reload runtime options to runtimeconfig.dev.json

The goal is to enable Hot Reload switches in all Debug builds, even if the project publishes AOT binaries.
We do so by generating runtimeconfig.dev.json, which overrides settings specified in runtimeconfig.json. The latter gets published while the former is only used for local development, thus the value of runtime switches of the published app can be different (Hot Reload disabled) than for dev builds (Hot Reload enabled).

This approach used to be blocked by dotnet/runtime#126606, which was recently fixed via
dotnet/runtime#128383. If the project targets .NET 10 or older the runtimeconfig.dev.json settings won't override runtimeconfig.json. We generate the dev.json file regardless as there is no harm to do so and it keeps the logic simpler.

See also discussion on dotnet/runtime#126546

Additionally, enable Hot Reload in dontet-watch when runtimeconfig.dev.json is generated with Hot Reload settings.

@tmat tmat changed the title Update GenerateRuntimeConfigurationFiles task to generate Hot Reload … [Experimental] Update GenerateRuntimeConfigurationFiles task to generate Hot Reload … Apr 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Due to lack of recent activity, this PR has been labeled as 'Stale'. It will be closed if no further activity occurs within 7 more days. Any new comment will remove the label.

@github-actions github-actions Bot added the stale label Jun 6, 2026
@tmat tmat force-pushed the GenerateHotReloadPropertiesToRuntimeConfigDev branch 2 times, most recently from 0036777 to 1a70afa Compare June 9, 2026 23:14
@tmat tmat changed the title [Experimental] Update GenerateRuntimeConfigurationFiles task to generate Hot Reload … Update GenerateRuntimeConfigurationFiles task to generate Hot Reload runtime options Jun 9, 2026
@tmat tmat marked this pull request as ready for review June 9, 2026 23:15
Copilot AI review requested due to automatic review settings June 9, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SDK’s runtimeconfig generation pipeline so runtimeconfig.dev.json can be generated for Hot Reload runtime switches (in addition to the existing probing-paths behavior), aligning with the Hot Reload runtime options requirements described in dotnet/runtime#126606.

Changes:

  • Split GenerateRuntimeConfigurationFiles dev-config generation into two independent switches: probing paths vs Hot Reload runtime options.
  • Update Microsoft.NET.Sdk.targets to compute GenerateRuntimeConfigDevFile based on the new switches and pass the new parameters to the task.
  • Add unit tests validating runtimeconfig.dev.json contents for Hot Reload-only, probing-paths-only, both enabled, and both disabled scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
test/Microsoft.NET.Build.Tasks.Tests/GivenAGenerateRuntimeConfigMultiThreading.cs Adds coverage for Hot Reload runtime options emission into runtimeconfig.dev.json under different switch combinations.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets Introduces new MSBuild properties for dev-config generation and wires them into the GenerateRuntimeConfigurationFiles task invocation.
src/Tasks/Microsoft.NET.Build.Tasks/GenerateRuntimeConfigurationFiles.cs Implements Hot Reload runtime switch emission into runtimeconfig.dev.json and gates probing-path generation behind a dedicated switch.

Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets Outdated
@tmat tmat marked this pull request as draft June 10, 2026 00:52
@github-actions github-actions Bot removed the stale label Jun 10, 2026
@tmat tmat force-pushed the GenerateHotReloadPropertiesToRuntimeConfigDev branch 4 times, most recently from c56c492 to 3f6c162 Compare June 23, 2026 15:59
@tmat tmat force-pushed the GenerateHotReloadPropertiesToRuntimeConfigDev branch 3 times, most recently from 87a437a to 28f6636 Compare June 30, 2026 18:47
@tmat tmat force-pushed the GenerateHotReloadPropertiesToRuntimeConfigDev branch from 0d022a1 to 8c817a5 Compare July 8, 2026 01:48
…runtime options to runtimeconfig.dev.json

Update dotnet-watch to recognize the new setting.
@tmat tmat marked this pull request as ready for review July 12, 2026 01:48
@tmat tmat requested review from a team as code owners July 12, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants