I upgraded a netcore1.1 project to the new VS2017/csproj.
In my test projects only, it added:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
I did some digging to discover that it generates these files in the bin directory:
ProjectName.Tests.runtimeconfig.json
ProjectName.Tests.runtimeconfig.dev.json
What is this setting and these files, and why do I need them?
Why were they only generated for my test projects?
These are specific to .NET Core projects and specify
Microsoft.NETCore.App
. The "host framework resolver" looks for a matching folder inside the shared
folder (e.g. C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.2
). This is important since multiple runtimes can be installed side-by-side and the host needs to know which one to use when you run dotnet myapp.dll
.<ServerGarbageCollection>true</ServerGarbageCollection>
int he csproj file, this will cause a value in the runtimeconfig.json
to be set. (This property is defaulted to true for web projects)additionalProbingPath
for example is set to your local NuGet cache which contains the restored packages. You may have noticed that referencing a NuGet package does not cause its dll files to be copied to the output directory (by default). The host uses the additional probing path to look for packages / dlls referenced to in this location (actually it is a two-step lookup: deps.json
tells the host which packages to use and this property tells where to look for this package). Since this is only used for development and shouldn't end up in the published output (since this would mean relying on a NuGet cache on the target), this settings is put into a runtimeconfig.dev.json
."Classic" .NET Framework projects also had a concept of letting the application set some runtime settings. This was accomplished by having an .exe.config
file (which would be built from an App.config
file in a project if present). You can think of runtimeconfig.json
as "the new .exe.config
" but the only have a few overlapping concerns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With