Here is part of my  A.csproj:
 <ItemGroup>
    <Content Include="..\..\Payloads\**\*.*">
      <Link>Payloads\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>None</CopyToOutputDirectory>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>
Payloads directory is created in a project B which is referenced from project A
B.csproj
 <PropertyGroup>
    <PostBuildEvent>
      xcopy /I /S /R /Y /d $(TargetDir)*.* $(SolutionDir)Payloads\Content
    </PostBuildEvent>
  </PropertyGroup>
Payloads directory doesn't exist in publish directory when I run dotnet publish
Info
dotnet SDK version 2.0, ASP.NET Core 2.0 on .NET 461 framework
It seems like publish content is calculated before the build. When I run dotnet publish if Payloads exists it is deployed correctly. This is just simplified example of my projects.
 How can I fix this?