Tag Archive: msbuild

TFS Error MSB4062

When I was migrating our TFS build to .NET Framework 4.0 from 3.5 SP1, I got the following error.

error MSB4062: The “xxx” task could not be loaded from the assembly xxx.dll. Could not load file or assembly ‘file:///xxx.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.

To resolve this error, you’d have to change the full path to the directory of MSBuild.exe in the TFS build service configuration file.

  1. Stop the Visual Studio Team Foundation Build service.
  2. Open the file C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config.
  3. Set the path for the new .NET Framework in the MSBuildPath setting: <add key="MSBuildPath" value="C:\Windows\Microsoft.NET\Framework\v4.0.30319" />
  4. Start the service.

Today I migrated our Visual Studio 2008 solution to Visual Studio 2010, and I started getting the following error when I kicked off a TFS build.

“The working folder [/source] is already in use by the workspace [workspace name];[owner] on computer [tfs server].”

After some research, it turned out that I just needed to run a command to clear the workspace cache.

tf workspace /delete /server:[tfs server] [workspace name];[owner]

Not too bad. 🙂