Visual Studio 2015 git 出现错误

10

我把我的代码放在Git里,通过Visual Studio 2015内置的Git工具进行集成。我正在运行Windows 10。

最近,我的团队资源管理器窗口(通常显示我的未提交的更改或其他内容)开始显示这个:

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsurePackageLoaded(IServiceProvider serviceProvider, Guid packageGuid)
at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsureSccAndTfPackagesLoaded(IServiceProvider serviceProvider)
at Microsoft.TeamFoundation.Git.Provider.Settings.SettingsLinksSectionVS.Initialize(Object sender, SectionInitializeEventArgs e)
at Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerSectionHost.Initialize(Object context)

或者类似的错误,具体取决于我访问哪个页面,例如:

System.Exception: Exception of type 'System.Exception' was thrown.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsurePackageLoaded(IServiceProvider serviceProvider, Guid packageGuid)
at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsureSccAndTfPackagesLoaded(IServiceProvider serviceProvider)
at Microsoft.TeamFoundation.Git.Provider.Repositories.GitTeamProjectExtendedInfoProvider.set_ServiceProvider(IServiceProvider value)
at Microsoft.VisualStudio.TeamFoundation.TeamExplorer.ConnectPage.ConnectPageVS.Initialize(Object sender, PageInitializeEventArgs e)
at Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerPageHost.Initialize(TeamExplorerPageContext context)

我去检查设置(工具-->选项-->源代码控制),发现当前的源代码控制插件(之前设置为git)现在变成了“无”。我点击下拉菜单并将其改回git...然后它又立即变回了“无”。

启动VS时,我还开始收到一个错误消息(无法加载SccProviderPackage)(与这里相同的错误)

但我不知道如何继续追寻这个问题。

以下是VS日志文件中的一些相关行:

109 ERROR SetSite failed for package [SccProviderPackage] 
110 ERROR End package load [SccProviderPackage] 
...
683 Warning Unexpected system error mode before loading package [GitCollaborationPackage] 

我已经尝试了以下故障排除步骤:

  1. 在Visual Studio中运行修复程序
  2. 更改安装选项,以便安装所有可选项目
  3. 检查系统事件日志...没有发现问题
  4. 清除Visual Studio组件模型缓存
  5. 移除GitHub扩展程序
  6. 完全卸载Visual Studio(以及所有其他工具如SQL工具和程序文件目录)并重新安装
  7. 在安全模式下启动
  8. 运行devenv /setup

我可以使用命令行git完成任务,但我更喜欢VS中的集成功能。你有什么想法是哪里出了问题(进行故障排除)或如何修复它吗?


1
尝试更新GitHub扩展程序。之前有问题导致出现了一些问题。 - jessehouwing
1
它能在一个干净的 Git 仓库上工作吗? - jessehouwing
1
你尝试过清除ComponentModel缓存吗?https://dev59.com/5mMm5IYBdhLWcg3wduxV#17604007 - jessehouwing
1
尝试过在安全模式下启动Visual Studio吗?尝试过删除你的Visual Studio扩展吗? - jessehouwing
@jessehouwing没有提供帮助,已更新问题。 - Aaron
显示剩余5条评论
1个回答

11

所以在这种情况下,从管理员VS命令提示符运行devenv/resetuserdata修复了我的问题...不确定为什么或出了什么问题,只是在运行此命令后,源代码控制开始工作了。没有更多的错误信息。

http://tech.trailmax.info/2014/01/vs-package-did-not-load-correctly/和jessehouwing表达感谢,帮助调试。


2
我尝试了上述方法,但最终在ActivityLog.xml文件中找到了解决方案。原来我从另一个文件夹复制了(GIT)源代码,它无法找到绑定,即使我没有打开解决方案。重命名文件夹让我摆脱了错误信息,并选择Git作为我的源代码控制。 - Shailen Sukul
我以管理员身份运行了Visual Studio,这解决了我的问题。 - Praveen Patel G
1
我又遇到了另一个项目的同样问题。但是这次,通过先 Push 再 Pull 分支来解决了它..!! 如果你只尝试 Pull,它是行不通的..!! - Praveen Patel G

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接