Question
· Jul 6, 2020

How to generate runtimeconfig.json\deps.json for dependency with dotnet publish?

I'm building a .Net Core Gateway container. Here's the issue.

As a final step I'm building a .Net Core 2.1 library. It has a runnable dependency - .Net Gateway, which I need to start first.

However dotnet publish generates .runtimeconfig.json and .deps.json only for my library and not for my dependency (.Net Gateway).

Is there a way to force dotnet to generate .runtimeconfig.json and .deps.json for a dependency?

I have tried:

  <PropertyGroup>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <GenerateDependencyFile>true</GenerateDependencyFile> 
   <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

but it did not help.

As a workaround I can copy my app .runtimeconfig.json to the dependency .runtimeconfig.json but it seems hacky (it also
prevents me from building self-contained Gateway container). Is there a better option?

I have prepared the test case, if anyone wants to try it:

git clone https://github.com/eduard93/gerenate-runtimeconfig.json.git
cd gerenate-runtimeconfig.json
docker build --tag mbs .
docker run --name mbs mbs
docker rm mbs --force

If you remove the comment from Line 24 in the Dockerfile with the copy workaround the image would run successfully.

Without workaround I get this error:

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app/'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the /app/IRISGatewayCore21.runtimeconfig.json file specifying the appropriate framework.
Discussion (2)0
Log in or sign up to continue