title: .Net Core 2.0 "Generate Nuget package on build" issue with Post-build events
body: <p>The new .NET Core 2.0 projects provide and easy and convenient way to create Nuget Package from the project output. Just click on the "Generate Nuget package on build" check box and it is done.
  <a href="https://i.stack.imgur.com/3ayQ7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3ayQ7.png" alt="enter image description here"></a>
  It works fine but I have an issue with Post-build events.
  I want to copy all of the packages from a solution after each build to a specific folder. So I use the "<em>Post-build event command line</em>" with a script:</p>
  
  <pre><code>xcopy "$(ProjectDir)$(OutDir)..*.nupkg" "$(SolutionDir)..\WebServicePracticesNuget\" /Y /I
  </code></pre>
  
  <p>And sometimes it works fine sometimes not at all. So far my investigation concluded that the Nuget package creation is not part of the build process itself. So the script (sometimes) will triggered before the package was generated and it is unpredictable. My solution is to add some delay. Unfortunately "<strong>timeout x</strong>" is not working with Post-build events. So I used the fallback option:</p>
  
  <pre><code>ping 127.0.0.1 -n 4 &gt; NUL
  </code></pre>
  
  <p>Which makes it almost reliable (~95%) but I think it is "poor man's" solution. And looks ridiculous in a Post-build event script. I have already <a href="https://developercommunity.visualstudio.com/content/problem/157079/generate-nuget-package-on-build-issue-with-post-bu.html" rel="noreferrer">reported</a> this issue to the VS team. But not much comments or solution so far.</p>
  
  <p>So my question is: does anybody have the same issue? Or any idea for a better solution then I have now?
  Thanks.</p>