PageRenderTime 28ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/nunit/runner/clr.bat

#
Batch | 96 lines | 82 code | 14 blank | 0 comment | 21 complexity | 8baa404e62748be34a030ee1c7e8890d MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. @echo off
  2. rem Run a program under a particular version of the .Net framework
  3. rem by setting the COMPLUS_Version environment variable.
  4. rem
  5. rem This command was written by Charlie Poole for the NUnit project.
  6. rem You may use it separately from NUnit at your own risk.
  7. if "%1"=="/?" goto help
  8. if "%1"=="?" goto help
  9. if "%1"=="" goto GetVersion
  10. if /I "%1"=="off" goto RemoveVersion
  11. if "%2"=="" goto SetVersion
  12. goto main
  13. :help
  14. echo Control the version of the .Net framework that is used. The
  15. echo command has several forms:
  16. echo.
  17. echo CLR
  18. echo Reports the version of the CLR that has been set
  19. echo.
  20. echo CLR version
  21. echo Sets the local shell environment to use a specific
  22. echo version of the CLR for subsequent commands.
  23. echo.
  24. echo CLR version command [arguments]
  25. echo Executes a single command using the specified CLR version.
  26. echo.
  27. echo CLR off
  28. echo Turns off specific version selection for commands
  29. echo.
  30. echo The CLR version may be specified as vn.n.n or n.n.n. In addition,
  31. echo the following shortcuts are recognized:
  32. echo net-1.0, 1.0 For version 1.0.3705
  33. echo net-1.1, 1.1 For version 1.1.4322
  34. echo beta2 For version 2.0.50215
  35. echo net-2.0, 2.0 For version 2.0.50727
  36. echo.
  37. echo NOTE:
  38. echo Any specific settings for required or supported runtime in
  39. echo the ^<startup^> section of a program's config file will
  40. echo override the version specified by this command, and the
  41. echo command will have no effect.
  42. echo.
  43. goto done
  44. :main
  45. setlocal
  46. set CMD=
  47. call :SetVersion %1
  48. shift /1
  49. :loop 'Copy remaining arguments to form the command
  50. if "%1"=="" goto run
  51. set CMD=%CMD% %1
  52. shift /1
  53. goto :loop
  54. :run 'Execute the command
  55. %CMD%
  56. endlocal
  57. goto done
  58. :SetVersion
  59. set COMPLUS_Version=%1
  60. rem Substitute proper format for certain names
  61. if /I "%COMPLUS_Version:~0,1%"=="v" goto useit
  62. if /I "%COMPLUS_Version%"=="net-1.0" set COMPLUS_Version=v1.0.3705&goto report
  63. if /I "%COMPLUS_Version%"=="1.0" set COMPLUS_Version=v1.0.3705&goto report
  64. if /I "%COMPLUS_Version%"=="net-1.1" set COMPLUS_Version=v1.1.4322&goto report
  65. if /I "%COMPLUS_Version%"=="1.1" set COMPLUS_Version=v1.1.4322&goto report
  66. if /I "%COMPLUS_Version%"=="beta2" set COMPLUS_Version=v2.0.50215&goto report
  67. if /I "%COMPLUS_Version%"=="net-2.0" set COMPLUS_Version=v2.0.50727&goto report
  68. if /I "%COMPLUS_Version%"=="2.0" set COMPLUS_Version=v2.0.50727&goto report
  69. rem Add additional substitutions here, branching to report
  70. rem assume it's a version number without 'v'
  71. set COMPLUS_Version=v%COMPLUS_Version%
  72. :report
  73. echo Setting CLR version to %COMPLUS_Version%
  74. goto done
  75. :GetVersion
  76. if "%COMPLUS_Version%"=="" echo CLR version is not set
  77. if NOT "%COMPLUS_Version%"=="" echo CLR version is set to %COMPLUS_Version%
  78. goto done
  79. :RemoveVersion
  80. set COMPLUS_Version=
  81. echo CLR version is no longer set
  82. :done