TFS 2010 - VersionControl.config is not valid and cannot be loaded

徘徊边缘 提交于 2019-12-10 01:10:20

问题


Recently, we experienced a strange problem with TFS 2010. We spent a few days before we figured it out. Just want to share my knowledge on the problem that might help other people.

It was working before with no problem for about 2 years. But suddenly, the builds started failing with the following error:

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. MSBUILD : error MSB4017: The build stopped unexpectedly because of an unexpected logger failure. Microsoft.Build.Exceptions.InternalLoggerException: The build stopped unexpectedly because of an unexpected logger failure. ---> Microsoft.TeamFoundation.VersionControl.Client.VersionControlException: The cache file C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded. Please correct or delete the file. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.TeamFoundation.VersionControl.Client.InternalCacheLoader.LoadConfig(InternalCache currentCache, Boolean dataDirectoryExists, InternalWorkspaceConflictInfo[]& conflictingWorkspaces) --- End of inner exception stack trace --- at Microsoft.TeamFoundation.VersionControl.Client.InternalCacheLoader.LoadConfig(InternalCache currentCache, Boolean dataDirectoryExists, InternalWorkspaceConflictInfo[]& conflictingWorkspaces)

Deletion of the contents of Cache folder mentioned in the error message did not help.

There was a coincidence of 2 things around that time:

  • the server was running out of free space in drive C:

  • our support people were installing Windows updates, including Service Pack 1 for TFS as well.

Some of our projects were 32 bit, like Silverlight for example, that must be 32 bit, never 64 yet. However, our TFS server is 64 bit. In order to compile projects properly, the build definitions should specify either "Auto" (that runs 64 bit compilation as the TFS server is) or "X86" that enforces 32 bit compilation.

Those ones that are X86 started failing all of a sudden with the error mentioned above.

SOLUTION:

Apparently, there is another location of Cache folder as well: C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache

We deleted the contents of that folder, and everything started working properly.

BTW: it has nothing to do with the /m switch. We tried it as well, but it did not help.


回答1:


I had the same issue after a low disk space warning.

Deleting/renaming the file C:\Users\user.name\AppData\Local\Microsoft\Team Foundation\4.0\Cache\VersionControl.config solved the issue in my case.




回答2:


Clear all cache folders:

  • %WINDIR%\System32\Config\Systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache
  • %WINDIR%\SysWOW64\Config\Systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache



回答3:


Team Explorer showed up as connected to TFS. But "Source Control Explorer" was labeled as disconnected.

deleting "C:\Users\user.name\AppData\Local\Microsoft\Team Foundation\4.0\Cache\VersionControl.config" solved the issue too. (thx)




回答4:


Following @mhu's implication that the TFS Cache directories should be cleared, I did a full search for "Team Foundation" folders that had a Cache sub-folder on my build server.

I then created a batch file that deletes them. My builds worked after this script was run.

Filename: ClearTFSCache.bat File content:

@echo+

@echo Removing TFS Cache Folder #1
@RD /S /Q "C:\Users\AAA_USERNAME\AppData\Local\Microsoft\Team Foundation\4.0\Cache"

@echo Removing TFS Cache Folder #2
@RD /S /Q "C:\Windows\ServiceProfiles\BBB_SERVICEACCOUNT\AppData\Local\Microsoft\Team Foundation\4.0\Cache"

@pause

There are two variables that should be replaced here:-

  1. AAA_USERNAME is for the current user's user name (based on manually logging into the server).
  2. BBB_SERVICEACCOUNT is for the account used to run the TFS Build Service, accessible via the Team Foundation Server Administration Console:

    In my case, it was 'NetworkService'.



来源:https://stackoverflow.com/questions/16048111/tfs-2010-versioncontrol-config-is-not-valid-and-cannot-be-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!