question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet build doesn't write runtime properties to .runtimeconfig.json on .NET 2.1

See original GitHub issue

Using .NET Core 2.1

mkdir repro
cd repro
dotnet new console

Edit repro.csproj to add ServerGarbageCollection property:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <ServerGarbageCollection>true</ServerGarbageCollection>
  </PropertyGroup>
</Project>
dotnet build

Open the repro.runtimeconfig.json:

{
  "runtimeOptions": {
    "tfm": "netcoreapp2.1",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "2.1.0"
    }
  }
}

It should have the System.GC.Server property:

    "configProperties": {
      "System.GC.Server": true
    }

Running:

dotnet publish

Will produce the correct .runtimeconfig.json into the publish folder.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vitek-karascommented, Mar 27, 2019

Sorry - I can’t repro it either now. I know I tried it several times yesterday, but now on the same machine it works just fine. I guess I must have run into the incremental build issue without realizing it…

Sorry again for the confusion.

1reaction
vitek-karascommented, Mar 27, 2019

There are two separate issues here:

The one tracked by this bug, which is about the fact that runtime properties are not written to .runtimeconfig.json on .NET Core 2.1 (and probably 2.2). It works on 3.0. This is true even for clean/build. Basically this issue is about the discussion whether we can fix it for 2.* apps in some way.

The other problem is that changing settings which affect .runtimeconfig.json are not triggering rebuild of that file during incremental dotnet build. That issue is tracked by #2787 - or it seems so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET core 2.1 Custom Nuget package. Problem with ...
Problem with missing *. runtimeconfig. json file in the project where the package was installed.
Read more >
runtimeconfig.dev.json file not generated - .NET
The .NET SDK no longer generates the runtimeconfig.dev.json file by default. This file was not used in most scenarios, and finding and loading ......
Read more >
Deep-dive into .NET Core primitives, part 3: runtimeconfig. ...
Finally we are using B. runtimeconfig. json (both DLL's has same runtime needs) to execute A. dll like "dotnet exec --runtimepath B.
Read more >
.NET SDK Support
The dotnet build command builds the project and its dependencies into a set of ... A .runtimeconfig.json file, which specifies the shared runtime...
Read more >
.NET Core buildpack | Cloud Foundry Docs
NET Runtime version, you must modify your app's .runtimeconfig.json file to include the applyPatches property and set the property to false .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found