title: dotnet publish include extra files
body: <p>I have a netcore application depends on my custom project. Because I cannot reference it directly, I have written postbuildevents that are copying my files to output:</p>
  
  <pre><code>xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.abi" "$(TargetDir)" /Y /I
  xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.bin" "$(TargetDir)" /Y /I
  </code></pre>
  
  <p>It works fine when I build and run project, but when run <code>publish</code> command it doesn't include these files.</p>
  
  <p>How can it be done? I tried <a href="https://stackoverflow.com/questions/45998779/dotnet-publish-doesnt-include-files-generated-during-post-build-event">this approach</a> as well but <code>AddPayloadsFolder</code> doesn't get called.</p>
  
  <p>My <code>csproj</code>:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;OutputType&gt;Exe&lt;/OutputType&gt;
      &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;ProjectReference Include="..\..\Dependencies\Dependencies.csproj" /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;None Update="appsettings.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
      &lt;None Update="log4net.config"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
  
    &lt;Target Name="PostBuild" AfterTargets="PostBuildEvent"&gt;
      &lt;Exec Command="xcopy &amp;quot;$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.abi&amp;quot; &amp;quot;$(TargetDir)&amp;quot; /Y /I&amp;#xA;&amp;#xA;&amp;#xD;&amp;#xA;xcopy &amp;quot;$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.bin&amp;quot; &amp;quot;$(TargetDir)&amp;quot; /Y /I" /&gt;
    &lt;/Target&gt;
  
    &lt;Target Name="AddPayloadsFolder" AfterTargets="AfterPublish"&gt;
      &lt;Exec Command="xcopy &amp;quot;$(TargetDir)\*.abi&amp;quot; &amp;quot;$(PublishDir)&amp;quot; /Y /I&amp;#xA;&amp;#xA;&amp;#xD;&amp;#xA;xcopy &amp;quot;$(TargetDir)\*.bin&amp;quot; &amp;quot;$(PublishDir)&amp;quot; /Y /I" /&gt;
    &lt;/Target&gt;
  
  &lt;/Project&gt;
  </code></pre>