少しでも問題が解決できれば幸いです。警告が表示される可能性のあるコードをデバッグするのが最善の方法ではないことはわかっていますが、アイデアの合間に少し休憩があるときはいつでもデバッグするのが好きです。mono と、Mac OS X Mountain Lion で実行される C# コードをコンパイルする可能性について知りました。CodeRunnerアプリに統合しましたが、問題なく動作します。ただし、コードに警告が表示される場合は機能しません。
たとえば、1 つの整数 (それ以上のものはありません) を作成するコードをコンパイルしようとしましたが、その警告のためにデバッグされませんでした。次のエラー メッセージが表示されます。
Untitled.cs(9,29): warning CS0219: The variable `test' is assigned but its value is never used
Cannot open assembly 'Compilation succeeded - 1 warning(s)
Untitled.exe': No such file or directory.
誰かがそれに対処する方法を知っているかもしれません。必須の機能ではないことはわかっていますが、未使用の変数がいくつかある場合でもコードをデバッグしたいと考えています。
コンパイル スクリプト ファイルの内容:
#!/bin/bash
enc[4]="UTF8" # UTF-8
enc[10]="UTF16" # UTF-16
enc[5]="ISO8859-1" # ISO Latin 1
enc[9]="ISO8859-2" # ISO Latin 2
enc[30]="MacRoman" # Mac OS Roman
enc[12]="CP1252" # Windows Latin 1
enc[3]="EUCJIS" # Japanese (EUC)
enc[8]="SJIS" # Japanese (Shift JIS)
enc[1]="ASCII" # ASCII
rm -rf "$4"/csharp-compiled
mkdir "$4"/csharp-compiled
#mcs is the Mono CSharp Compiler
file="$1"
length=${#file}
first=`expr $length - 3`
classname=`echo "$file" | cut -c 1-"$first"`
#echo -out:"$4"/csharp-compiled/"$classname".exe "$1"
dmcs -out:"$4"/csharp-compiled/"$classname".exe "$1"
status=$?
if [ $status -ne 0 ]
then
exit $status
fi
#echo "$4"/csharp-compiled/
currentDir="$PWD"
cd "$4"/csharp-compiled/
files=`ls -1 *.exe`
status=$?
if [ $status -ne 0 ]
then
exit 1
fi
cd "$currentDir"
for file in $files
do
mv -f "$4"/csharp-compiled/$file "$file"
done
# Otherwise output the name of the input file without extension (this should be the same as the class name)
file="$1"
length=${#file}
first=`expr $length - 3`
classname=`echo "$file" | cut -c 1-"$first"`
echo $classname".exe"
exit 0