MSBuild Copy Goes To A Different (Incorrect) Location

Deepak Vasudevan 96 Reputation points
2021-04-03T06:43:54.68+00:00

I have the following in my .CSPROJ file

<Target Name="PostPublish" BeforeTargets="MSDeployPublish">
<Exec WorkingDirectory="$(MSBuildProjectDirectory)"
Command='robocopy $(MSBuildProjectDirectory)\Love $(PublishDir)\Love /S /COPY:DATS /NP /NFL /NDL /v' ContinueOnError="true" />
</Target>

Now the folder Love in Web Project is going to bin\app.publish instead of the Web Deploy location. Is there a different variable for Web Deploy location other than $(PublishDir) or should I use this in a different event other than BeforeTargets?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,960 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2021-04-05T07:23:45.523+00:00

    Hi lavanyadeepak,

    You need to confirm if the PublishDir is the specified path in your csproj file. And maybe you can create a <DotNetPublishFiles> to publish the files to your specified directory.

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments