Check out example codes for "msbuild publish to folder command line .net". It will help you in understanding the concepts better.

Code Example 1

msbuild mysln.sln /p:DeployOnBuild=true /p:PublishProfile=<profile-name>

Learn ReactJs, React Native from akashmittal.com