我想检测哪个版本的VS是我的NuGet包安装的。有可能吗?
答案 0 :(得分:1)
您可以使用PowerShell检测Visual Studio版本。如果Visual Studio版本不支持JavaScript的intellisense文件,JQuery使用此技术显示警告。在JQuery的NuGet包中有一个install.ps1脚本,它包含以下PowerShell:
param($installPath, $toolsPath, $package, $project)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersion = $vsVersion.Major
Write-Host "IntelliSense JS files are not supported by your version of Visual Studio: $displayVersion"
exit
}