Skip to content

Commit f28d954

Browse files
authored
Merge pull request #146 from kamgam/master
Added a Paths.cmd template so users can add their local VisualStudio …
2 parents fa85d30 + 417e98a commit f28d954

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,4 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
/Paths.cmd

Build.cmd

+50-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,59 @@
11
@echo off
2+
3+
REM Default VS paths to check if no Paths.cmd file exists
4+
set VISUAL_STUDIO_PATH_0="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
5+
set VISUAL_STUDIO_PATH_1="%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"
6+
set VISUAL_STUDIO_PATH_2="%programfiles(x86)%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe"
7+
set VISUAL_STUDIO_PATH_3="%programfiles(x86)%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe"
8+
29
pushd "%~dp0"
310
if exist Debug rd /s /q Debug
411
if exist Release rd /s /q Release
512
if exist x64 rd /s /q x64
613

7-
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release
14+
if exist "Paths.cmd" (
15+
REM Prefer Paths.cmd as Visual Studio path source if it exists.
16+
call Paths.cmd
17+
goto build
18+
) else (
19+
REM Otherwise try to auto-detect the Visual Studio path.
20+
if exist %VISUAL_STUDIO_PATH_0% (
21+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_0%
22+
goto build
23+
)
24+
25+
if exist %VISUAL_STUDIO_PATH_1% (
26+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_1%
27+
goto build
28+
)
29+
30+
if exist %VISUAL_STUDIO_PATH_2% (
31+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_2%
32+
goto build
33+
)
34+
35+
if exist %VISUAL_STUDIO_PATH_3% (
36+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_3%
37+
goto build
38+
)
39+
40+
REM No default path found. Let the user know what to do.
41+
echo No Visual Studio installation found. Please configure it manually.
42+
echo 1. Copy 'Paths.cmd.template'.
43+
echo 2. Rename it to 'Paths.cmd'.
44+
echo 3. Enter your Visual Studio path in there.
45+
echo 4. Restart the build.
46+
REM Allow disabling pause to support non-interacting build chains.
47+
if NOT "%~1"=="-no-pause" pause
48+
goto end
49+
)
50+
51+
:build
52+
REM Log the used Vistual Studio version.
53+
@echo on
54+
%VISUAL_STUDIO_PATH% /p:Configuration=Release
55+
@echo off
856

9-
:exit
57+
:end
1058
popd
1159
@echo on

Paths.cmd.template

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
REM Set your Visual Studio path here.
3+
SET VISUAL_STUDIO_PATH="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
4+
@echo on

0 commit comments

Comments
 (0)