title: Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\1\s\$(buildStagingDirectory)
body: <p>Building CI pipeline for .Net core APIs in VSTS. But while building getting the below error.</p>
  
  <pre><code>Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\1\s\$(buildStagingDirectory)
  </code></pre>
  
  <p>This is my build definition looks like</p>
  
  <p><a href="https://i.stack.imgur.com/MpHkP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MpHkP.png" alt="enter image description here"></a></p>
  
  <p>I have mentioned PathToPublish as <code>$(buildStagingDirectory)</code></p>
  
  <p>How do I get rid of this error??</p>