app.runtimeconfig.json is not optional
See original GitHub issueAccording 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:
- Created 6 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
TLDR; If you are getting a
Could not find the required '[app-name].runtimeconfig.json'
error add the following to thePropertyGroup
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?Without it, the file is not created and my FDD app doesn’t run and it fails with the following message