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?
and how would you specify that user's password in msbuild?
arconaut
2009-09-16 15:49:40
you're right, I forgot RunAs _asks_ for password vs accepting it as a param :(I guess you could do use /savecred but that would require you doing it manually the first time, on the build machine and under the credentials of the build service.
zvolkov
2009-09-16 17:14:41
+2
A:
It's best to create a quick extension of CallTarget task that uses Impersonator by Uwe Keim, like this:
public class Impersonate : CallTarget
{
[Required]
public string UserName { get; set; }
[Required]
public string Domain { get; set; }
[Required]
public string Password { get; set; }
public override bool Execute()
{
using (new Impersonator(this.UserName, this.Domain, this.Password))
{
return base.Execute();
}
}
}
Then call will look like this:
<Target Name="DoSms">
<....>
</Target>
<Target Name="Impersonate">
<Impersonate Targets="DoSms" UserName="username" Password="password" Domain="domain"/>
</Target>
Professor AK
2010-10-27 12:53:11