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.

app.runtimeconfig.json is not optional

See original GitHub issue

According to this documentation Runtime Conifguraiton Files, app.runtimeconfig.json is an optional configuration file. However, it doesn’t look like it’s the case.

Steps to reproduce

I have the following test app:

using System;
namespace test {
    class Program {
        static void Main(string[] args) {
            Console.WriteLine("Hello World!");
        }
    }
}

Run the following commands in sequence:

dotnet publish cd bin\Debug\netcoreapp2.0\publish del test.runtimeconfig.json dotnet test.dll

Expected behavior

Application writes to console:

Hello World!

Actual behavior

Dotnet executable reports the following error:

A fatal error was encountered. The library ‘hostpolicy.dll’ required to execute the application was not found in 'd:\workspace\test\bin\Debug\netcoreapp2.0\publish'.

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MeTituscommented, Jul 14, 2018

I very much thing this issue is still out there.

I have the latest update to VS2017 and without this setting

<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>

the runtimeconfig.json file is not generated.

I have addded runtimeconfig.template.json to the root project, as per https://github.com/dotnet/cli/issues/9126

and it still does not work. I don’t think you guys could have messed this more even if you wanted.

2reactions
onemacommented, Jan 17, 2018

TLDR; If you are getting a Could not find the required '[app-name].runtimeconfig.json' error add the following to the PropertyGroup in your .csproj

<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>


The language here is really misleading. If the *runtimeconfig.json why do I have to include the following statement to my *.csproj, but without it, my app doesn’t run?

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <====?
  </PropertyGroup>
</Project>

Without it, the file is not created and my FDD app doesn’t run and it fails with the following message

"Could not  find the required '[app-name].runtimeconfig.json'.  This file should be present at the root of the deployment package."
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to build App without App.runtimeconfig.json?
As you can see, App.runtimeconfig.json contains the runtime information and used .NET Core version, you can't simply delete it.
Read more >
NET Runtime configuration settings
json file exists in the same folder as the project file, any configuration options it contains are inserted into the [appname].runtimeconfig.
Read more >
Deep-dive into .NET Core primitives, part 3: runtimeconfig. ...
The runtimeconfig.json file is technically optional, but for practical reasons, every real-world app has it. The file can be hand-edited. Unlike ...
Read more >
How to generate runtimeconfig.json\deps. ...
As a workaround I can copy my app .runtimeconfig.json to the dependency ... required to execute the application was not found in '/app/'....
Read more >
Libhostpolicy.dylib missing - Meadow Development
1/App.runtimeconfig.json' file and specify the appropriate framework. Failed to run as a self-contained app. The program '[14012] dotnet ...
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