@echo off
echo Building V2GDecoder VC++ Project...

REM Check if Visual Studio 2022 is installed (Professional or Community)
set MSBUILD_PRO="C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
set MSBUILD_COM="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
set MSBUILD_BT="F:\(VHD) Program Files\Microsoft Visual Studio\2022\MSBuild\Current\Bin\MSBuild.exe"

if exist %MSBUILD_PRO% (
    echo "Found Visual Studio 2022 Professional"
    set MSBUILD=%MSBUILD_PRO%
) else if exist %MSBUILD_COM% (
    echo "Found Visual Studio 2022 Community"
    set MSBUILD=%MSBUILD_COM%
) else if exist %MSBUILD_BT% (
    echo "Found Visual Studio 2022 BuildTools"
    set MSBUILD=%MSBUILD_BT%
) else (
    echo "Visual Studio 2022 (Professional or Community) not found!"
    echo "Please install Visual Studio 2022 or update the MSBuild path."
    pause
    exit /b 1
)

REM Build Debug x64 configuration
echo Building Debug x64 configuration...
%MSBUILD% agvmapeditor.csproj

pause