Skip to content

Commit 93f9394

Browse files
committed
Add script to start solution in VS
1 parent c3fd390 commit 93f9394

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

start-vs.cmd

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET Core SDK.
5+
6+
:: This tells .NET Core to use the same dotnet.exe that build scripts use
7+
set DOTNET_ROOT=%~dp0.dotnet
8+
set DOTNET_ROOT(x86)=%~dp0.dotnet\x86
9+
10+
:: This tells .NET Core not to go looking for .NET Core in other places
11+
set DOTNET_MULTILEVEL_LOOKUP=0
12+
13+
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
14+
set PATH=%DOTNET_ROOT%;%PATH%
15+
16+
call restore.cmd
17+
18+
if not exist "%DOTNET_ROOT%\dotnet.exe" (
19+
echo [ERROR] .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools
20+
exit /b 1
21+
)
22+
23+
:: Prefer the VS in the developer command prompt if we're in one, followed by whatever shows up in the current search path.
24+
set "DEVENV=%DevEnvDir%devenv.exe"
25+
26+
set SLN=Arcade.sln
27+
28+
if exist "%DEVENV%" (
29+
:: Fully qualified works
30+
set "COMMAND=start "" /B "%ComSpec%" /S /C ""%DEVENV%" "%~dp0%SLN%"""
31+
) else (
32+
where devenv.exe /Q
33+
if !errorlevel! equ 0 (
34+
:: On the PATH, use that.
35+
set "COMMAND=start "" /B "%ComSpec%" /S /C "devenv.exe "%~dp0%SLN%"""
36+
) else (
37+
:: Can't find devenv.exe, let file associations take care of it
38+
set "COMMAND=start /B .\%SLN%"
39+
)
40+
)
41+
42+
%COMMAND%

0 commit comments

Comments
 (0)