0

I have tfs local server. I write unit test , that execute batch file. The problem is: when I manual execute batch file it's perfect work. But when this script execute programmatically (check-in unit test and build definition. Test starts on build server by unknown credential) I see half result. So. How can visual studio (use c#) starts batch file, use credential of another user?

user3231442
  • 600
  • 1
  • 9
  • 25

2 Answers2

0

If I understand the issue you have, I'd recommend using runas. So it will be something like:

runas.exe /profile /user:YOURDOMAIN\YourUser %yourpath%\yourbatch.bat
You can set this to VS to run, instead your batch.

Hope this helps!
0

You can use

System.Diagnostics.Process.Start(filenameToStart, username, password, domain);

There's also a similar thread here

And another with a code sample here

Community
  • 1
  • 1
Mike
  • 3,186
  • 3
  • 26
  • 32