Obs*_*nix 3 registry powershell tfs visual-studio-2017
我有一个PowerShell脚本,它查看VS安装列表,并确定安装的最高版本.然后它使用该版本的InstallDir,并使用它来访问各种命令.
但它仍然使用较低版本.
从VS2017开始,似乎不再以相同的方式保存注册表项.我需要更新脚本才能找出2017年的设置.
#Add New Versions to this list when new versions of VS are released
$VsVersionsToDisable = "10.0", "11.0", "12.0", "14.0"
[System.Collections.ArrayList]$VsVersions = $VsVersionsToDisable
#Find the Highest installed VS Version, and use it for the TFS.exe Command.
foreach ($version in $VsVersions | Sort-Object -Descending)
{
$keyPath = "HKCU:\Software\Microsoft\VisualStudio\$version`_Config"
If (Test-Path $keyPath)
{
$aliasPath = Get-ItemProperty -Path $keyPath | Select-Object `
-ExpandProperty InstallDir
$proxyPath = Join-Path $aliasPath "tf.exe"
set-alias proxyTF $proxyPath
}
}
Run Code Online (Sandbox Code Playgroud)
要避免XY问题:我们使用此脚本为用户配置TFS代理设置.它确定最高安装版本,使用它来查找代理,然后迭代通过配置其代理设置的较低版本使用相同的值.
确定tf.exe
VS2017 的安装目录(以及位置)的最佳方法是什么?
从我所看到的,使用SxS\VS7选项:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7
Run Code Online (Sandbox Code Playgroud)
它应该为您提供Visual Studio的根路径:
这应该让你去.
tf.exe
然后使用符号链接存储该位置:
.\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3123 次 |
最近记录: |