Files
terminal/src/tools/ColorTool/build.bat
skycommand 5585183d7d ColorTool: Proofread the helper text, update Build.bat (#2644)
First, my changes to `build.bat`:

1. `Build.bat` now looks for Visual Studio 2019 too.
2. `Build.bat` now ensures that the linker places ColorTool.exe into
   `\debug` or `\release` folders, not `\debug\net471` or
   `\release\net471`.
3. `Build.bat` is now smarter in its search. It determines the operating
   system's CPU architecture before deciding whether to search in "Program
   Files (x86)" or "Program Files".

Second, my changes to the help text displayed to the user:

1. The help text now makes it clear that some switches cannot be used
   with certain others.
2. Some typos are fixed. e.g. "ct" to "ColorTool" (it took me two hours
   to figure this one out!) and "schemename" to "scheme name".

I've made a minor change to the order of `switch (arg)` in Program.cs
too, to ensure that the terminating switches are analyzed first. This
way, there will be fewer surprises if the user supplies malformed input.
But feel free to reject this one.

# Unresolved issues

`Build.bat` is inherently faulty. On a pristine computer, a user cannot
just install the latest version of Microsoft Build Tool and run
`build.bat` to build ColorTool. The reason is the absence of certain
NuGet packages. Either NuGet or Visual Studio must download the
dependencies first.

# Validation Steps Performed

Since the changes to the code are minor, I don't know what test I can
possibly devise, other than compiling it and seeing that it works.
2019-12-03 12:44:23 -08:00

70 lines
1.9 KiB
Batchfile

@echo off
rem Add path to MSBuild Binaries
set MSBUILD=()
for /f "usebackq tokens=*" %%f in (`where.exe msbuild.exe 2^>nul`) do (
set MSBUILD="%%~ff"
goto :FOUND_MSBUILD
)
set AppFiles=%ProgramFiles(x86)%
if NOT %PROCESSOR_ARCHITECTURE%==AMD64 set AppFiles=%ProgramFiles%
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
set MSBUILD="%AppFiles%\MSBuild\14.0\bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
echo "MSBuild was not found. Make sure it is installed and included in the search path."
goto :EXIT
:FOUND_MSBUILD
echo MSBuild was found at %MSBUILD%
echo.
set _MSBUILD_TARGET=Build
set _MSBUILD_CONFIG=Debug
:ARGS_LOOP
if (%1) == () goto :POST_ARGS_LOOP
if (%1) == (clean) (
set _MSBUILD_TARGET=Clean,Build
)
if (%1) == (rel) (
set _MSBUILD_CONFIG=Release
)
shift
goto :ARGS_LOOP
:POST_ARGS_LOOP
%MSBUILD% %~dp0ColorTool.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG% /p:OutputPath=.\bin\%_MSBUILD_CONFIG%\
if (%ERRORLEVEL%) == (0) (
echo.
echo Created exe in:
echo %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\ColorTool.exe
echo.
echo Copying exe to root of project...
copy %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe %~dp0ColorTool.exe
echo.
)
:EXIT
Pause