3

The command below worked flawlessly before updating to VS 2019 16.10.0:

msbuild.exe MySolution.sln /t:Project1;Project2;Project3 /p:Configuration=Release /p:DebugType=None /p:OutputPath="C:\Users\myuser\Desktop\Build"

After the update I'm getting the message error MSB4057: the target "Project1" does not exist in the project when I try the command in Developer Command Prompt of VS 2019.

jcs
  • 611
  • 2
  • 9
  • 22

2 Answers2

9

Until Microsoft releases an update we found that you can add :Rebuild to the end of your projects and that fixed it for us.

msbuild.exe MySolution.sln /t:Project1:Rebuild;Project2:Rebuild;Project3:Rebuild /p:Configuration=Release /p:DebugType=None /p:OutputPath="C:\Users\myuser\Desktop\Build"
chrsdy
  • 106
  • 1
0

As an alternative if you like to avoid the rebuild suggested by the accepted answer:

  • Add a custom target to the project files like <Target Name="MyBuild" DependsOnTargets="Build" />
  • Call this target from the script, e.g. msbuild.exe MySolution.sln /t:Project1:MyBuild;Project2:MyBuild;Project3:MyBuild /p:Configuration=Release /p:DebugType=None /p:OutputPath="C:\Users\myuser\Desktop\Build"
Paul B.
  • 2,394
  • 27
  • 47