Skip to content

.NET Core MSBuild should not generate an empty assembly when building a meta-package project #1021

@daxian-dbw

Description

@daxian-dbw

I have a .NET Core meta-package project defined in project.json. It contains no code but just references to a few other sub-projects and some packages. This meta-package project exists for 2 purposes:

  1. A NuGet meta-package can be produced that references to the NuGet packages of those sub-projects.
  2. The top-level project can reference only to this meta-package project to chain the dependency to those sub-projects.

This works fine with project.json -- when building the meta-package project, all referenced sub-projects get built and the meta-package project itself doesn't produce anything.
Now with .NET Core SDK 1.0, I'm migrating from project.json to .csproj via dotnet migrate, and I find the behavior has changed -- building the meta-package project still get the referenced sub-projects built, but itself starts to produce an empty assembly.

This causes an empty meta-package.dll to appear in the publish folder of the top-level project, and I cannot simply remove it with an after-build target because it's also recorded in the generated .deps.json file, which makes it part of the TPA (trusted platform assemblies). So simply removing the empty assembly will cause the application to crash at startup.

Note that I have set <IncludeBuildOutput>false</IncludeBuildOutput> in the meta-package project file. It does help to make the empty assembly not included in the NuGet package produced out of the meta-package project, but the empty assembly still gets produced, and that causes the empty assembly to be published and put in the deps.json file when building the top-level project.

The project.json file and the corresponding .csproj file are attached. It's part of the powershell core project, and you can see the whole project at https://github.com/PowerShell/PowerShell/tree/master/src.
The Microsoft.PowerShell.SDK meta-package project is referenced by powershell-unix\project.json, powershell-win-core\project.json and powershell-win-full\project.json.

project.json.txt
Microsoft.PowerShell.SDK.csproj.txt

/cc: @eerhardt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions