Getting “unable to cast object type” error while editing TFS build.

Hello.

Have you ever faced an issue where you need to modify or edit a build definition which was create using VS 2010 for TFS 2010 or before? When you try to edit the “Configurations to Build” section of your build definition, you might see some error such as below.

Unable to cast object type error
Unable to cast object type error

BuildWorkflow2

Before you can work with TFS 2010 build workflows you must add a few assembly redirects to Visual Studio 2012 configuration files to enable it to communicate properly with TFS 2010. This section explains how to do that. You will need local administrative privileges to be able to do this.

  1. Navigate to “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\”
  2. Open devenv.exe.config file in a text editor and navigate to the “assemblyBinding” section.
devenv.exe.config
devenv.exe.config
  1. Add the following assembly redirects as last elements inside the “assemblyBinding” section.
<dependentAssembly>

<assemblyIdentity name=”Microsoft.TeamFoundation.Build.ProcessComponents” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>

<bindingRedirect oldVersion=”10.0.0.0″ newVersion=”11.0.0.0″/>

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name=”Microsoft.TeamFoundation.Build.Workflow” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>

<bindingRedirect oldVersion=”10.0.0.0″ newVersion=”11.0.0.0″/>

</dependentAssembly>

  1. Save the file, and restart Visual Studio (if you have any open), for the changes to take effect.

If you are using Visual Studio 2013, you will need to replace 11 with 12 both in assemblyBinding and the path to devenv.exe.config file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s