Skip to content

Commit

Permalink
Add batch files for testing
Browse files Browse the repository at this point in the history
Add batch files to launch Visual Studio (Code) with the locally installed .NET SDK version for use with daily builds.
  • Loading branch information
martincostello committed Jun 11, 2024
1 parent b37d844 commit c0093f9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
24 changes: 24 additions & 0 deletions startvs.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ECHO OFF
SETLOCAL

:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET SDK.

:: This tells .NET to use the same dotnet.exe that the build script uses.
SET DOTNET_ROOT=%~dp0.dotnetcli
SET DOTNET_ROOT(x86)=%~dp0.dotnetcli\x86

:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use.
SET PATH=%DOTNET_ROOT%;%PATH%

SET sln=%~dp0ProjectEuler.sln

IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
echo The .NET SDK has not yet been installed. Run `%~dp0build.ps1` to install it
exit /b 1
)

IF "%VSINSTALLDIR%" == "" (
start "" "%sln%"
) else (
"%VSINSTALLDIR%\Common7\IDE\devenv.com" "%sln%"
)
29 changes: 29 additions & 0 deletions startvscode.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@ECHO OFF
SETLOCAL

:: This command launches Visual Studio Code with environment variables required to use a local version of the .NET SDK.

:: This tells .NET to use the same dotnet.exe that the build script uses.
SET DOTNET_ROOT=%~dp0.dotnetcli
SET DOTNET_ROOT(x86)=%~dp0.dotnetcli\x86

:: Put our local dotnet.exe on PATH first so Visual Studio Code knows which one to use.
SET PATH=%DOTNET_ROOT%;%PATH%

:: Sets the Target Framework for Visual Studio Code.
SET TARGET=net9.0

SET FOLDER=%~1

IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
echo The .NET SDK has not yet been installed. Run `%~dp0build.ps1` to install it
exit /b 1
)

IF "%FOLDER%"=="" (
code .
) else (
code "%FOLDER%"
)

exit /b 1

0 comments on commit c0093f9

Please sign in to comment.