-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdeploy-exp.cmd
More file actions
88 lines (78 loc) · 3.3 KB
/
Copy pathdeploy-exp.cmd
File metadata and controls
88 lines (78 loc) · 3.3 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
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
REM =====================================================================
REM Deploy the extension into the Visual Studio experimental hive (Exp).
REM
REM deploy-exp.cmd Build Debug and deploy to the Exp hive.
REM deploy-exp.cmd -release Build Release instead of Debug.
REM deploy-exp.cmd -run The above, then start devenv /rootsuffix Exp
REM with this solution loaded.
REM
REM F5 and Ctrl+F5 from Visual Studio already deploy on their own, for
REM Debug and Release alike (the csproj sets DeployExtension for builds
REM inside VS). This script is the command-line equivalent, and the way
REM to recover when the Exp hive loses the extension: it retries after
REM rebuilding the hive's extension cache, which is what
REM "VSSDK1031 ... could not be found" on a first deploy needs.
REM
REM Either way the build removes any older version folder left in the
REM hive (RemoveStaleExpDeployments in the csproj) — two folders sharing
REM one VSIX identity is what makes Exp silently keep running the old
REM build after a version bump.
REM =====================================================================
setlocal EnableDelayedExpansion
REM --- Arguments (order-independent) -----------------------------------
set "CONFIG=Debug"
set "RUNAFTER="
:parseargs
if "%~1"=="" goto parsed
if /i "%~1"=="-release" set "CONFIG=Release"
if /i "%~1"=="-debug" set "CONFIG=Debug"
if /i "%~1"=="-run" set "RUNAFTER=1"
shift
goto parseargs
:parsed
REM --- Tool locations, VS 2026 first then VS 2022 -----------------------
set "VSROOT=C:\Program Files\Microsoft Visual Studio\18\Enterprise"
if not exist "%VSROOT%\MSBuild\Current\Bin\MSBuild.exe" (
set "VSROOT=C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
)
set "MSBUILD=%VSROOT%\MSBuild\Current\Bin\MSBuild.exe"
set "DEVENV=%VSROOT%\Common7\IDE\devenv.exe"
set "PROJ=%~dp0ClaudeCodeExtension.csproj"
set "SLN=%~dp0ClaudeCodeExtension.sln"
if not exist "%MSBUILD%" (
echo [ERROR] MSBuild.exe not found.
exit /b 1
)
if not exist "%DEVENV%" (
echo [ERROR] devenv.exe not found.
exit /b 1
)
REM Deploying over a running experimental instance leaves it on the old
REM binaries and can fail the copy outright.
tasklist /fi "imagename eq devenv.exe" | find /i "devenv.exe" >nul
if not errorlevel 1 (
echo [WARN] Visual Studio is running. Close any /rootsuffix Exp instance
echo before deploying, or it will keep the previous build loaded.
)
echo Building %CONFIG% and deploying to the Exp hive...
"%MSBUILD%" "%PROJ%" -t:Build -p:Configuration=%CONFIG% -p:DeployExtension=true -p:VSSDKTargetPlatformRegRootSuffix=Exp -v:minimal -nologo
if errorlevel 1 (
echo.
echo [INFO] Deploy failed. Rebuilding the Exp extension cache and retrying...
"%DEVENV%" /rootsuffix Exp /updateconfiguration
"%MSBUILD%" "%PROJ%" -t:Build -p:Configuration=%CONFIG% -p:DeployExtension=true -p:VSSDKTargetPlatformRegRootSuffix=Exp -v:minimal -nologo
if errorlevel 1 (
echo.
echo [ERROR] Deploy to the Exp hive failed.
exit /b 1
)
)
echo.
echo [OK] Deployed to %LocalAppData%\Microsoft\VisualStudio\^<version^>Exp\Extensions\Daniel Carvalho Liedke
if defined RUNAFTER (
echo Starting the experimental instance...
start "" "%DEVENV%" /rootsuffix Exp "%SLN%"
)
endlocal
exit /b 0