2016-04-26 96 views
0

我使用Visual Studio 2015年更新2,根據csi.exe有這樣的事情爲 'C#腳本文件':如何在Visual Studio中創建csx文件?

執行如果指定的腳本file.csx

有是這種格式的文件?我如何在Visual Studio中創建它們?


> csi.exe /? 

Microsoft (R) Visual C# Interactive Compiler version 1.2.0.60317 
Copyright (C) Microsoft Corporation. All rights reserved. 

Usage: csi [option] ... [script-file.csx] [script-argument] ... 

Executes script-file.csx if specified, otherwise launches an interactive REPL (Read Eval Print Loop). 

Options: 
    /help       Display this usage message (alternative form: /?) 
    /i        Drop to REPL after executing the specified script. 
    /r:<file>      Reference metadata from the specified assembly file (alternative form: /reference) 
    /r:<file list>     Reference metadata from the specified assembly files (alternative form: /reference) 
    /lib:<path list>    List of directories where to look for libraries specified by #r directive. 
           (alternative forms: /libPath /libPaths) 
    /u:<namespace>     Define global namespace using (alternative forms: /using, /usings, /import, /imports) 
    @<file>      Read response file for more options 
    --        Indicates that the remaining arguments should not be treated as options. 
+0

我在2011年發現了這篇博客文章https://blogs.msdn.microsoft.com/visualstudio/2011/10/19/introducing-the-microsoft-roslyn-ctp/但這些說明在Visual Studio中不起作用2015('Visual C#script'從'新文件'丟失) –

+0

https://msdn.microsoft.com/en-gb/magazine/mt614271.aspx –

+0

如果它只是一個文本文件,肯定不需要模板爲它創造它?你可以重命名你知道的文件 –

回答

0

我能夠在Visual Studio 2015 Update 2中創建一個C#腳本(.csx)文件,方法是在IDE中創建一個文本文件並使用.csx擴展名保存。然後,我可以在C#Interactive(csi.exe)中的C#腳本文件中右鍵單擊並選擇「在交互中執行」來執行C#代碼。它確實運行,但是沒有智能支持。

相關問題