How to publish .NET porject using msdeploy.exe through command line

Authoring Tools > Visual Studio 2019
MSDeploy.exe can be usually found under path C:\Program Files\IIS\Microsoft Web Deploy V3 on your computer.
 
First, publish your project to production files
 
cd your/project/path
dotnet publish <your_project.csproj> -o <output_folder>
for details about dotnet publish
 
 
Second, get your web deploy information from your Control Panel.
 
for instance:
Service URL https://demo-001-site3.itempurl.net:8172/MsDeploy.axd?site=demo-001-site3
Site/Application SiteName demo-001-site3
Username demo-001
Password your_password
 
 
The basic syntax is
 
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
    -verb:sync
    -source:contentPath=<your_local_path_to_project_production_directory>
    -dest:contentPath=<Site/Application_SiteName>,computerName=<Service_URL>,userName=<Username>,password=<your_password>,authtype="Basic",includeAcls="False"
    -allowUntrusted
    -disableLink:AppPoolExtension
    -disableLink:ContentExtension
    -disableLink:CertificateExtension
    -verbose
 
remember to replace the <parameter> with the correct value
 
 
a complete example
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:contentPath="your/local/path/to/project/production/direcotry" -dest:contentPath="demo-001-site3",computerName="https://demo-001-site3.itempurl.net:8172/MsDeploy.axd?site=demo-001-site3",userName="demo-001",password="your_password",authtype="Basic",includeAcls="False" -allowUntrusted -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -verbose
 
Related Link: