[WinForms] Make `ContextMenuStrip` behavior closer to the reference one (#18598)
[mono-project.git] / msvc / run-msbuild.sh
blobd90d8ac1615c90905cdb512a70b846eb7ef55171
1 #!/bin/bash
3 # Arguments:
4 #-------------------------------------------------------
5 # $1 Visual Studio target, build|clean, default build
6 # $2 Host CPU architecture, x86_64|i686, default x86_64
7 # $3 Visual Studio configuration, debug|release, default release
8 # $4 Additional arguments passed to msbuild, needs to be quoted if multiple.
9 #-------------------------------------------------------
11 function win32_format_path {
12 local formatted_path=$1
13 local host_win32_wsl=0
14 local host_win32_cygwin=0
16 host_uname="$(uname -a)"
17 case "$host_uname" in
18 *Microsoft*)
19 host_win32_wsl=1
21 CYGWIN*)
22 host_win32_cygwin=1
24 esac
26 if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then
27 formatted_path="$(wslpath -a -w "$1")"
28 elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then
29 formatted_path="$(cygpath -a -w "$1")"
32 echo "$formatted_path"
35 RUN_MSBUILD_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd)
36 RUN_MSBUILD_SCRIPT_PATH=$(win32_format_path "$RUN_MSBUILD_SCRIPT_PATH/run-msbuild.bat")
38 WINDOWS_CMD=$(which cmd.exe)
39 if [ ! -f $WINDOWS_CMD ]; then
40 WINDOWS_CMD=$WINDIR/System32/cmd.exe
43 "$WINDOWS_CMD" /c "$RUN_MSBUILD_SCRIPT_PATH" "$@"