PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/nunit/runner/clr.bat

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