Is it possible to pass the encrypted password somehow, or telling msbuild to use the .pubxml.user file?
It is impossible to pass the encrypted password by MSBuild command line. Just as you said, the .pubxml.user
file contains the password in encrypted form. This file can not be accessed by MSBuild when you deploy by MSBuild command line.
Besides, as aware as i know, the encrypted password is used for per-account and per-machine. So when you deploy your project to a different machine or account, encrypted password will be invalid when you deploy your project to the another machines or account.
So we need to pass the actual name and password with MSBuild command line;
msbuild <path-to-project-file> /p:DeployOnBuild=true /p:PublishProfile=<Publish Profile> /p:Username=<ACTUAL_USERNAME> /p:Password=<ACTUAL_PASSWORD>
See the Sayed`s answer and this document for more detail info.
Hope this helps.