Skip to content

configurationProperties specified in .runtimeconfig.json override those in .runtimeconfig.dev.json #126606

@tmat

Description

@tmat

Description

I don't see a reason why is it useful for a published property value to overwrite dev-only value. The reverse would make more sense.

The fix would be to add a condition to this line that skips the assignment if the property is already present:

m_properties[property.name.GetString()] = property.value.GetString();

This would technically be a minor breaking change. Since runtimeconfig.dev.json is disabled since .NET 6.0 and before that hasn't been used for specifying properties it shouldn't affect many customers.

We would like to use runtimeconfig.dev.json to specify values for Hot Reload related switches that are only applicable to local development and should be overridden by values in runtimeconfig.json.

Specifically, set both System.Reflection.Metadata.MetadataUpdater.IsSupported and System.StartupHookProvider.IsSupported to true in .runtimeconfig.dev.json and false in .runtimeconfig.json.

Change in the SDK: dotnet/sdk#53715

Reproduction Steps

Console app that prints the value of switches and .runtimeconfig.dev.json and .runtimeconfig.json files specifying different values.

repro.zip

Expected behavior

Values specified in .runtimeconfig.dev.json overwrite values specified in .runtimeconfig.json.

Actual behavior

The reverse

Regression?

No

Known Workarounds

Alternatively, we could use a single .runtimeconfig.json file and change the SDK publishing targets to patch it when publishing.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions