<commit_before>@if not defined _echo @echo off
setlocal

SET CMDHOME=%~dp0.
if "%BUILD_FLAGS%"=="" SET BUILD_FLAGS=/m:1 /v:m

:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
set Platform=

:: Restore the Tools directory
call %~dp0init-tools.cmd
if NOT [%ERRORLEVEL%]==[0] exit /b 1

set _toolRuntime=%~dp0Tools
set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe

SET PATH=%_toolRuntime%\dotnetcli;%PATH%

SET TOOLS_PACKAGES_PATH=%CMDHOME%\packages

SET SOLUTION=%CMDHOME%\Orleans.sln

SET LOGFILENAME_PREFIX=%BuildFlavor%

:: For log filename prefix if we're building default which is Current set it properly
if "%LOGFILENAME_PREFIX%"=="" SET LOGFILENAME_PREFIX=Current

:: Set DateTime suffix for debug builds
for /f %%i in ('powershell -NoProfile -ExecutionPolicy ByPass Get-Date -format "{yyyyMMddHHmm}"') do set DATE_SUFFIX=%%i

if "%1" == "Pack" GOTO :Package

@echo ===== Building %SOLUTION% =====
call %_dotnet% restore "%CMDHOME%\Build\Tools.csproj" --packages %TOOLS_PACKAGES_PATH%<commit_msg>Add installed dotnet.exe detection and version matching to build script. (#3376)<commit_after>@if not defined _echo @echo off
setlocal

SET CMDHOME=%~dp0.
if "%BUILD_FLAGS%"=="" SET BUILD_FLAGS=/m:1 /v:m

:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
set Platform=

for /f "tokens=*" %%i in ('where dotnet.exe') do set INSTALLED_DOTNET_EXE=%%i

if not exist "%INSTALLED_DOTNET_EXE%" goto :install-dotnet

echo Found dotnet.exe at: "%INSTALLED_DOTNET_EXE%"

for /f "tokens=*" %%i in ('"%INSTALLED_DOTNET_EXE%" --version') do set INSTALLED_DOTNET_VERSION=%%i

if [%INSTALLED_DOTNET_VERSION%]==[] (
  echo Cannot determine version of installed .Net Core
  goto :install-dotnet
)

echo .Net Core version found: %INSTALLED_DOTNET_VERSION%

set /p REQUIRED_DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"

echo .Net Core version required: %REQUIRED_DOTNET_VERSION%

if [%REQUIRED_DOTNET_VERSION%] neq [%INSTALLED_DOTNET_VERSION%] (
  echo .Net Core version mismatch, installing.
  goto :install-dotnet
) else (
  echo .Net Core version is matching, using the installed version.

  set _dotnet="%INSTALLED_DOTNET_EXE%"

  goto :dotnet-installed
)

:install-dotnet

:: Restore the Tools directory
call %~dp0init-tools.cmd
if NOT [%ERRORLEVEL%]==[0] exit /b 1

set _toolRuntime=%~dp0Tools
set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe

SET PATH=%_toolRuntime%\dotnetcli;%PATH%

:dotnet-installed

SET TOOLS_PACKAGES_PATH=%CMDHOME%\packages

SET SOLUTION=%CMDHOME%\Orleans.sln

SET LOGFILENAME_PREFIX=%BuildFlavor%

:: For log filename prefix if we're building default which is Current set it properly
if "%LOGFILENAME_PREFIX%"=="" SET LOGFILENAME_PREFIX=Current

:: Set DateTime suffix for debug builds
for /f %%i in ('powershell -NoProfile -ExecutionPolicy ByPass Get-Date -format "{yyyyMMddHHmm}"') do set DATE_SUFFIX=%%i

if "%1" == "Pack" GOTO :Package

@echo ===== Building %SOLUTION% =====
call %_dotnet% restore "%CMDHOME%\Build\Tools.csproj" --packages %TOOLS_PACKAGES_PATH%
{'fraction_non_alphanumeric': 0.12679938744257274, 'fraction_numerical': 0.007044410413476264, 'mean_word_length': 5.65173116089613, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1248198', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1122, 'n_words': 346}