# Failed to initialise Team Foundation server connection

**URL:** https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471
**Category:** Discussion
**Created:** [April 30, 2010, 7:23am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471 "2010-04-30T07:23:08Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 30, 2010, 7:23am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/1 "2010-04-30T07:23:08Z")

</div>

Hi,

I am using Visual Studio 2010, TFS 2010 and FinalBuilder 6.3.0.2026

When I run a TFS Team build, which include a FinalBuilder project, I receive the following error:

error : Failed to initialise Team Foundation server connection : An item with the same key has already been added.I receive this error before the actions in the FinalBuilder project are executed.

&nbsp;

Are there any known problems with using Finalbuilder 6 with TFS2010?

Thanx,  
Marco

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 3, 2010, 5:16am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/2 "2010-05-03T05:16:34Z")

</div>

Hi Marco,

Having a quick look around on the web it seems like your error can be caused by the TFS cache becoming corrupted or out of date. There's more information (including scripts to clean the cache)&nbsp;[here](http://social.msdn.microsoft.com/Forums/en-US/tfsworkitemtracking/thread/414a4352-5af1-4e6a-a65c-b0da44f1f3e1)&nbsp;and [here](http://blogs.msdn.com/mohamedg/archive/2009/03/09/error-an-item-with-the-same-key-has-already-been-added.aspx).

&nbsp;

With TFS2010 Microsoft have changed the build engine from MSBuild to Workflow Foundation. As a result, the VS.NET addin provided with FinalBuilder 6 does not work with TFS2010 and, for now, you cannot create new builds that use FinalBuilder. I'm currently working on a TFS2010 workflow element that will be part of FinalBuilder 7.

&nbsp;

Because there is no native support for TFS2010 in FinalBuilder 6, I assume that you've upgraded from TFS2008? If cleaning the cache doesn't work please let me know how you created the TFS build and I'll try and reproduce the error.&nbsp;

&nbsp;

Regards,

&nbsp;

Ben

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [November 18, 2010, 9:03am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/3 "2010-11-18T09:03:15Z")

</div>

We are also getting this error, but we are using VS2008 connected to TFS 2010 and FinalBuilder 6.3.0.2172.

You have mentioned that you where working on a fix for FinalBuilder 7, I have installed FB 7.0.0.787, but there does not seem to be any way that I can see to convert our existing TFS builds to use the new&nbsp;FB 7 projects.&nbsp; Also when I try and create a new Build project it will always try and create a FB 6 project rather than a FB 7 project.&nbsp; Therefore I am unable to find a way of making our builds work

Any help on this would be most gratefully appreciated.

Sean

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 19, 2010, 2:27am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/4 "2010-11-19T02:27:14Z")

</div>

Hi Sean,   
 Please see this article on how to integrate TFS2010 and FinalBuilder: [https://www.finalbuilder.com/articles.aspx?ID=38](https://www.finalbuilder.com/articles.aspx?ID=38), which will hopefully answer you questions. If not, please let me know.   
  
 Ben

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [November 19, 2010, 9:08am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/5 "2010-11-19T09:08:54Z")

</div>

Hi Ben,   
  
 Thanks for the article, that will help when we upgrade to Visual Studio 2010, but unfortunately we are still using Visual Studio 2008 on the build machine so that does not sort our problem out. We have only migrated the Server to TFS 2010. The projects etc. are still in Visual Studio 2008 and are likely to stay that way for a while yet.   
  
 Sean

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 21, 2010, 11:04am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/6 "2010-11-21T11:04:49Z")

</div>

Hi Sean,   
 Have you installed the forward compatibility update for VS2008? [http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=cf13ea45-d17b-4edc-8e6c-6c5b208ec54d](http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=cf13ea45-d17b-4edc-8e6c-6c5b208ec54d)   
  
 Have you tried cleaning the TFS cache?   
  
 What’s the exact error you’re seeing? And when does it occur?   
  
 Also, I’m not quite sure I understand your setup. When you say ‘build machine’, do you mean a TFS build agent?   
  
 Sorry for the 20 questions.   
  
 Ben

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [November 22, 2010, 8:45am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/7 "2010-11-22T08:45:52Z")

</div>

We have installed the forward compatibility update for VS2008 as we can see the server from the PC. We did try cleaning the TFS cache. The error message we are getting is:   
  
 C:\Documents and Settings\buildman\Local Settings\Temp\Symphony\Symphony Continuous\BuildType\TFSBuild.proj(222,5): error : Failed to initialise Team Foundation server connection : An item with the same key has already been added.   
  
 We get this for all of our continuous builds that we are running from Visual Studio. If I run the FB project directly populating the TFS Build variables manually before hand the build works fine.   
  
 The ‘build amchine’ is a machine that is running the TFS build agents has VS2008 installed on it, with the forward compatability installed.   
  
 Sean

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 23, 2010, 6:52am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/8 "2010-11-23T06:52:34Z")

</div>

Thanks for the info. I’m running up a test environment to try and replicate this - will let you know how I go.   
  
 Out of interest, are you able to run non-FinalBuilder builds through TFS on the build agent?   
  
 Cheers,   
  
 Ben

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 24, 2010, 5:42am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/9 "2010-11-24T05:42:09Z")

</div>

Hi again Sean,   
 So far I can’t reproduce the error you’re seeing. Here’s my setup:   
 - TFS Server/Controller: TFS2010 + FinalBuilder 7   
 - Build agent: TFS2010 build service + VS2008 SP1 + Team Explorer 2008 + FCU + FinalBuilder7   
  
 I created a new build definition in Team Explorer 2010, using FinalBuilderBuild.xaml, and successfully ran it on the build machine. I could successfully trigger the build from both Team Explorer 2008 and 2010.   
  
 Just to clarify, have you created a new build definition for building with TFS2010? Unfortunately because of the massive change between TFS2008 and 2010 its possible that existing FinalBuilder build definitions won’t be properly upgraded when via the TFS server upgrade process.   
  
 Cheers,   
  
 Ben

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [December 2, 2010, 12:18pm UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/10 "2010-12-02T12:18:01Z")

</div>

Hi Ben,

Sorry for the delay in getting back, but we have been trying to get a patch release of our software out to a client.

I have now tried creating a new build definition in Team Explorer 2010 using FinalBuilder.xaml.&nbsp; When I try and run the build from Visual Studio I get a "Object reference not set to an instance of an object." error.&nbsp; The project runs fine if I run it directly from FinalBuilder 7.

I have done a build&nbsp;with the diagnostic verbose set and attached the resulting log file.

I am at a loss to what object the error is refering to.

Sean

[001\_Build.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/3/3d920c57647615090688739f17c13ee0ba7e6dbb.zip) (55.813 KB)

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 3, 2010, 12:46pm UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/11 "2010-12-03T12:46:09Z")

</div>

Hi Sean,   
 Can you please download the latest test build of FinalBuilder from [https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700\_883.exe](https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700_883.exe) ? The object reference bug should be fixed in that build.   
  
 Please note that you’ll need to re-start the build service and update the XAML templates, as described here: [https://www.finalbuilder.com/articles.aspx?ID=43](https://www.finalbuilder.com/articles.aspx?ID=43)   
  
 Cheers,   
  
 Ben

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [December 3, 2010, 8:25am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/12 "2010-12-03T08:25:29Z")

</div>

Hi Ben,   
  
 We are making progress, but I now get the following when I am trying to perform a TFS Get.   
  
 FinalBuilder Output   
 Project File: C:\Builds\3\Symphony\Doco 2010\Sources\TeamBuildTypes\Doco Continuous\Doco Continuous.fbp7   
 Build Started: 03/12/2010 07:19:20   
 [Start ActionList: Main]   
 [Team Foundation Get [F:\]]   
 Path to Executable: D:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe   
 Workspace Directory: F:\   
 Command line: get “Symphony\Doco\*” “AA\SinglePoint\Doco\*” “Symphony\Dev\iExchange\Doco\*” “Symphony\Dev\iExchange\Testing\Test Plans\*” “Symphony\Symphony iValidate\Doco\*” “Symphony\Symphony iValidate\Testing\Test Plans\*” “Symphony\Symphony Oracle Restorer\Doco\*” “Symphony\Symphony iMatch\Doco\*” “iSearchWeb\Doco\*” “Symphony\Symphony iPlot\Doco\*” “SNN\Doco\*” /overwrite /recursive /noprompt   
 Unable to determine the workspace. You may be able to correct this by running ‘tf workspaces /collection:TeamProjectCollectionUrl’.   
 Failed!   
  
 I have run tf workspaces, but I still get the same error.   
  
 Cheers   
 Sean

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 5, 2010, 11:59am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/13 "2010-12-05T11:59:28Z")

</div>

Hi Sean,   
 At least we’re at the stage where FinalBuilder is running. Slow progress, but progress I guess.   
  
 Are you using the ‘default working folder’ option in the TFS Get action? FinalBuilder options are per-user: my suspicion is that you’ve set the default working folder when logged in as a user other than the user the one TFS uses to run the build. There’s two ways around this:   
  
 1. log in as the user TFS uses, launch FinalBuilder, set the default working directory   
 2. set the working folder explicitly in the action. If you need to use this in multiple actions, you can use a project variable.   
  
 Out of interest, why are you using FB to do your TFS get, rather than the TFS build process? Usually it makes more sense to tell TFS which workspaces to get in the build definition, so it does it when its setting up the build agent.   
  
 Cheers,   
  
 Ben

---

<div class="post-metadata">

### Author: ![sean.flook](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@sean.flook](https://www.finalbuilder.com/forums/u/sean.flook)
#### Post date: [December 6, 2010, 3:42am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/14 "2010-12-06T03:42:01Z")

</div>

Hi Ben,   
  
 I have altered the build process to not use the Get, but allow TFS to do this. The project I am using is a fairly basic one that gets the latest version of our documentation and then copies it to certain locations so that other members of the team can then use it. Therefore there is no project to actually build. If I leave the Projects to Build blank in the Process I get the following error from FinalBuilder   
  
 Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index   
  
 If I add a project and include it in the Workspaces, then the FinalBuilder project does work.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 6, 2010, 11:33am UTC](https://www.finalbuilder.com/forums/t/failed-to-initialise-team-foundation-server-connection/1471/15 "2010-12-06T11:33:23Z")

</div>

Hi Sean,   
 Glad you’re up and running. For info, you should be able to specify any file in TFS as the project to build - it doesn’t have to be a .sln. That way there’s no need to create a dummy project.   
  
 Cheers,   
  
 Ben
