2011-08-28 82 views

回答

5

你可以通過使用編譯器選項following constructor

var providerOptions = new Dictionary<string, string>(); 
providerOptions.Add("CompilerVersion", "v3.5"); 
var compiler = new CSharpCodeProvider(providerOptions); 
... 
3

您需要在編譯器設置,如字典來指定它:

var settings = new Dictionary<string,string>(); 
settings.Add("CompilerVersion", "v3.5"); 
var compiler = new CSharpCodeProvider(settings); 

不出所料,谷歌已經提出了一些這樣的例子; herehere