Skip to content

MSB4057: GetCopyToPublishDirectoryItems missing for per-RID project #259

Open

Description

@alexrp

I have a project looking like this:

<Project Sdk="MSBuild.Sdk.Extras">
    <PropertyGroup>
        <ExtrasBuildEachRuntimeIdentifier>true</ExtrasBuildEachRuntimeIdentifier>
        <IsPackable>true</IsPackable>
        <NoWarn>$(NoWarn);NU5131</NoWarn>
        <RuntimeIdentifiers>@(SupportedRuntimes)</RuntimeIdentifiers>
        <TargetFrameworks>net6.0</TargetFrameworks>
    </PropertyGroup> 

    <ItemGroup>
        <ReferenceAssemblyProjectReference Include="../ref/runtime.ref.csproj" />
    </ItemGroup>
</Project>

It builds/packs fine on its own.

I reference it from another project like this:

        <ProjectReference Include="../runtime/src/runtime.src.csproj"
                          SkipGetTargetFrameworkProperties="true"
                          ReferenceOutputAssembly="false" />

However, running dotnet pack from this project results in:

runtime.src.csproj : error MSB4057: The target "GetCopyToPublishDirectoryItems" does not exist in the project.

A workaround I'm using for now is adding this at the bottom of the first project:

    <Target Name="GetCopyToPublishDirectoryItems" />

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions