How can I copy files as a different user from msbuild?

.net, c#, msbuild

Solution

Try Exec task to execute RunAs.exe which would run the xcopy.exe

Problem

I am trying to copy files to a remote server, the account I am running my build server doesn't have permissions though. How can I do it using different credentials?

Original source