Home > Software engineering >  what is adding "System.Reflection.Metadata.MetadataUpdater.IsSupported": false to my runti
what is adding "System.Reflection.Metadata.MetadataUpdater.IsSupported": false to my runti

Time:11-25

I have a library (dll). For some reason, when I compile, file .runtimeconfig.json is generated:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "6.0.0"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "6.0.0"
      }
    ],
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false
    }
  }
}

Why is this file generated and why does it contain "System.Reflection.Metadata.MetadataUpdater.IsSupported": false? This is a non runable library, so why is a .runtimeconfig.json generated?

CodePudding user response:

The runtime config file as far as I know is only created for executables and tells the dotnet runtime what runtime version to use and what frameworks (e.g. aspnet core) to include as these are bundled with the runtime. As dotnet executables in most cases however are dll files aswell with an executable as a "starter" it is possible you might have both as an output.

See also https://github.com/dotnet/runtime/blob/9d6396deb02161f5ee47af72ccac52c2e1bae458/docs/design/features/sharedfx-lookup.md#framework-search-and-rolling-forward

Does your csproj by any chance include <OutputType>Exe</OutputType> and a main somewhere?

The System.Reflection.Metadata.MetadataUpdater.IsSupported part as far as I can see tells the runtime that the app you're running doesn't support Metadata Updates (I assume that has something to do with hot reload). This gets added when the app is build in release mode.

CodePudding user response:

Generating the config file is controlled by GenerateRuntimeConfigurationFiles setting in .csproj: probably is set to true. Please see this section of Microsoft help regarding generating and purpose of runtimeconfig.json. And here is the concise description of the property metadataupdater.issupported. More detailed explanation also here: What is the purpose of msbuild's GenerateRuntimeConfigurationFiles?

  • Related