You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

10 years ago
  1. param($installPath, $toolsPath, $package, $project)
  2. . (Join-Path $toolsPath common.ps1)
  3. # VS 11 and above supports the new intellisense JS files
  4. $vsVersion = [System.Version]::Parse($dte.Version)
  5. $supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
  6. if (-not $supportsJsIntelliSenseFile) {
  7. $displayVersion = $vsVersion.Major
  8. Write-Host "IntelliSense JS files are not supported by your version of Visual Studio: $displayVersion"
  9. exit
  10. }
  11. if ($scriptsFolderProjectItem -eq $null) {
  12. # No Scripts folder
  13. Write-Host "No Scripts folder found"
  14. exit
  15. }
  16. # Delete the vsdoc file from the project
  17. try {
  18. $vsDocProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("jquery-$ver-vsdoc.js")
  19. Delete-ProjectItem $vsDocProjectItem
  20. }
  21. catch {
  22. Write-Host "Error deleting vsdoc file: " + $_.Exception -ForegroundColor Red
  23. exit
  24. }
  25. # Copy the intellisense file to the project from the tools folder
  26. $intelliSenseFileSourcePath = Join-Path $toolsPath $intelliSenseFileName
  27. try {
  28. $scriptsFolderProjectItem.ProjectItems.AddFromFileCopy($intelliSenseFileSourcePath)
  29. }
  30. catch {
  31. # This will throw if the file already exists, so we need to catch here
  32. }
  33. # Update the _references.js file
  34. AddOrUpdate-Reference $scriptsFolderProjectItem $jqueryFileNameRegEx $jqueryFileName