Git-在 powershell 中 运行 时出现 Tfs 错误。 "Retrieve LoaderExceptions"

Git-Tfs error when running in powershell. "Retrieve LoaderExceptions"

我在 Windows Server 2012 R2 上使用 chocolatey 安装了 git-tfs。当我尝试通过键入“git tfs --version”检查 git tfs 是否正确安装时,我收到以下错误:

Unable to load one or more of the requested types. Retrieve LoaderExceptions for more information

我检查了创建的日志文件,这是它显示的内容:

[Debug] System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at GitTfs.Program.DoCustomConfiguration(CustomConfigurationExpression initializer)
at GitTfs.Program.Initialize(CustomConfigurationExpression initializer)
at StrucutreMap.Container..ctor(Action`1 action)
at GitTfs.Program.Main(String[] args)

我真的很想在这里得到一些帮助。我在这里错过了什么?

根据 git-tfs 的 document,我们需要安装 .NET 4.6.2 和 2012 或 2013 版本的团队资源管理器(或 Visual Studio),具体取决于您要定位的 TFS 版本。

git-tfs 的最新版本(v0.32.0) 有一些变化:

  • 升级到 .NET Framework 4.7.2 并升级 NuGet 依赖项
  • 添加对 Visual Studio 2017 的支持。要使用它,请设置环境 变量 GIT_TFS_CLIENT 到 2017. VS2017 的多个版本 并排安装,或者像 VS2017 这样的不同版本 Enterprise 和 Premium 或不同的 VS2017 次要版本都不是 官方还支持。当前的实现将简单地使用 找到第一个版本。
  • 添加对 Visual Studio 2019 的支持。要使用它,请设置环境 变量 GIT_TFS_CLIENT 到 2019。与 VS2017 的限制相同 申请,例如并排安装多个版本的VS2019, 作为不同的版本,如 VS2019 Enterprise 和 Premium 或 官方尚未支持不同的 VS2019 次要版本。这 当前的实现将只使用找到的第一个版本。

如果在安装 git-tfs 时遇到任何问题,我们可以尝试重新安装 .NET framework、Visual Studio 2019 和 Git。