How can I enable Server GC in .NET Core?

2019-03-25 03:00发布

问题:

I have a .NET Core app (MyApp.exe) developed in VS2017 running on the 1.0.4 version of the SDK. I have tried adding an App.config with the following entries:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <gcServer enabled="true"/>
  </runtime>
</configuration>

Which on build is renamed to: MyApp.config.

But this does not change the GC mode; Any ideas?

回答1:

Based on this source, you do that via the csproj:

<PropertyGroup>
  <ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>