Sdk: dotnet build & dotnet publish do not include runtimeconfig.json for referenced applications

Created on 23 Nov 2018  路  4Comments  路  Source: dotnet/sdk

Steps to reproduce

  1. Create new .NET Core 2.1 Console App solution/project in your favorite IDE (Project A)
  2. Create a new .NET Core 2.1 Console App project in the same solution. (Project B)
  3. Reference Project B in Project A
  4. dotnet build and/or dotnet publish Project A
  5. Notice that Project B's .runtimeconfig.json file is not in Project A's bin/*/netcoreapp2.1/ folder

Expected behavior

Project B's .runtimeconfig.json is included in the bin directory of Project A.

Actual behavior

Project B's .runtimeconfig.json is not in the bin directory of Project A.

Environment data

dotnet --info output:

```
.NET Core SDK (reflecting any global.json):
Version: 2.1.500
Commit: b68b931422

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk2.1.500

Host (useful for support):
Version: 2.1.6
Commit: 3f4f8eebd8

.NET Core SDKs installed:
2.1.2 [C:Program Filesdotnetsdk]
2.1.4 [C:Program Filesdotnetsdk]
2.1.102 [C:Program Filesdotnetsdk]
2.1.103 [C:Program Filesdotnetsdk]
2.1.104 [C:Program Filesdotnetsdk]
2.1.200 [C:Program Filesdotnetsdk]
2.1.201 [C:Program Filesdotnetsdk]
2.1.202 [C:Program Filesdotnetsdk]
2.1.400 [C:Program Filesdotnetsdk]
2.1.401 [C:Program Filesdotnetsdk]
2.1.402 [C:Program Filesdotnetsdk]
2.1.403 [C:Program Filesdotnetsdk]
2.1.500 [C:Program Filesdotnetsdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.4 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.4 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
````

Most helpful comment

I needed to do something similar recently so I just added it as a sample here:
https://github.com/dasMulli/AdvancedMSBuildDemos/tree/master/PublishedAppP2PReference

See MainApp which ""references"" two sub-apps and produces an output / publish layout putten them in different subdirectories

All 4 comments

This is by design.

We don't have a notion of a P2P reference as an exe.

If you want to publish both apps, you need to publish each of them separately.

Darn, I have a project that needs separate executable's in a single bin, with each executable being sourced in its own project. Sucks that I have to manually copy over those files using Build Events.

Though I guess I could make them self contained binaries.

You can also specify the output folder when publishing to be the same, so that no copy is necessary.

However, we don't really recommend bin placing two separate applications in the same folder, as they may have dependencies on the same assembly but at different versions and they may stomp on each other and cause the app to fail during runtime.

I needed to do something similar recently so I just added it as a sample here:
https://github.com/dasMulli/AdvancedMSBuildDemos/tree/master/PublishedAppP2PReference

See MainApp which ""references"" two sub-apps and produces an output / publish layout putten them in different subdirectories

Was this page helpful?
0 / 5 - 0 ratings