2012-08-05 80 views
2

我正在與Codedom一起編譯單個的Exes和自定義圖標。Codedom編譯器圖標選項錯誤

這是我使用指定圖標文件的代碼:

string temp; 
temp = string.Format("/target:winexe /win32icon:{0}", testico); 
cp.CompilerOptions = temp; 

泰斯蒂科在這種情況下是一個字符串,指定在上述圖標的位置。

現在的問題是,上面的代碼只有在文件路徑中沒有空格時纔有效。

因此,允許用空格文件路徑,我修改了代碼,以這樣的:

string temp; 
temp = string.Format("/target:winexe /win32icon:\"{0}\"", testico); 
cp.CompilerOptions = temp; 

不幸的是,這是行不通的。

任何想法? 感謝

+0

根據[這個答案](http://stackoverflow.com/a/5921078/266143),其語法應該是正確的。你可以在調試時檢查'temp'變量嗎? – CodeCaster 2012-08-05 21:42:10

回答

1

嘗試:

\"/win32icon:{0}\" 

引號包圍整個參數

+0

謝謝你!這很好用! – 2012-08-05 22:44:55