-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUpgrade.cmd
More file actions
75 lines (66 loc) · 1.94 KB
/
Upgrade.cmd
File metadata and controls
75 lines (66 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@echo off
rem ************************************************************
rem
rem Script to upgrade a single project or solution file to a
rem newer version of Visual Studio. Due to the Express versions
rem not shipping with a full version of DEVENV the Solution
rem files have to be upgraded using the IDE.
rem
rem NB: You must set the environment variables first by running
rem the SetVars script.
rem
rem ************************************************************
setlocal enabledelayedexpansion
:handle_help_request
if /i "%~1" == "-?" call :usage & exit /b 0
if /i "%~1" == "--help" call :usage & exit /b 0
:check_args
if /i "%~1" == "" call :usage & exit /b 1
:verify_toolchain
if /i "%TOOLCHAIN%" == "" (
echo ERROR: Compiler environment variables not set. Run 'SetVars' first.
exit /b 1
)
echo Upgrading '%~1'...
:do_upgrade
if /i "%VC_EDITION%" == "retail" (
devenv /upgrade "%~1"
if errorlevel 1 exit /b 1
) else (
vcexpress "%~1"
if errorlevel 1 exit /b 1
)
:do_cleanup
echo.
echo Cleaning up...
if exist "%~dp1..\..\..\Lib" (
del /s %~dp1..\..\..\Lib\*.vcproj.*.*.old 2> nul
del /s %~dp1..\..\..\Lib\*.vcproj.*.*.user 2> nul
)
if exist "%~dp1..\Lib" (
del /s %~dp1..\Lib\*.vcproj.*.*.old 2> nul
del /s %~dp1..\Lib\*.vcproj.*.*.user 2> nul
)
del %~dpn1.sln.old 2> nul
del %~dp1Backup\%~n1.sln 2> nul
del /ah %~dp1Backup\%~n1.suo 2> nul
del /s %~dp1\*.vcproj.*.*.old 2> nul
del /s %~dp1\*.vcproj.*.*.user 2> nul
del /s %~dp1\UpgradeLog*.htm 2> nul
del /s %~dp1\UpgradeLog*.XML 2> nul
for /d %%d in (%~dp1Backup\*.*) do rmdir /q %%d 2>nul
rmdir /q %~dp1Backup 2> nul
for /d %%d in (%~dp1Backup2\*.*) do rmdir /q %%d 2>nul
rmdir /q %~dp1Backup2 2> nul
rmdir /s /q %~dp1\_UpgradeReport_Files 2> nul
:success
exit /b 0
rem ************************************************************
rem Functions
rem ************************************************************
:usage
echo.
echo Usage: %~n0 [solution]
echo.
echo e.g. %~n0 lib\project\Solution.sln
goto :eof