0
votes

I created custom build activity in my TFS build template. In that custom activity I added some code which purpose is to connect to TFS read last build number, create custom number and set new number to TFS.

To connect to TFS I am using following code:

NetworkCredential netCred = new NetworkCredential("username", "password");           
TfsTeamProjectCollection server = new TfsTeamProjectCollection(new Uri("https://someproject.visualstudio.com/DefaultCollection")), netCred);
server.Authenticate();

That code works properly when I tried to execute from my local computer in some sample console application. But when I tried to execute that code during TFS build it throw exception.

1
can you compare your access rights to the build machine rights .. sounds like a permissions issue and or user account / service account issue.. do you have a system admin on staff where you are currently working check this previous posting for some hints as well stackoverflow.com/questions/12685111/…MethodMan
I am using administrator account in this case. These credentials work for from sample app. I am not sure why I have permission issues!kat1330
the number one misconception with most developers is that just because it works or things work on your local machine and or environment, that they will automatically work the same in the target environment .. so I can only assume that there's a permission issueMethodMan

1 Answers

0
votes

You don't need authentication: the build is running with high privileges with respect to TFS access.