【问题标题】:How to create csx file in Visual Studio?如何在 Visual Studio 中创建 csx 文件?
【发布时间】:2016-04-26 13:39:06
【问题描述】:

我正在使用 Visual Studio 2015 Update 2。根据csi.exe 有“C# 脚本文件”之类的东西:

如果指定,则执行 script-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.

【问题讨论】:

标签: c# visual-studio-2015 csx csi


【解决方案1】:

我能够在 Visual Studio 2015 Update 2 中创建一个 C# 脚本 (.csx) 文件,方法是在 IDE 中创建一个文本文件并将其保存为 .csx 扩展名。然后,我可以通过右键单击并选择在 Interactive 中执行来在 C# Interactive (csi.exe) 的 C# 脚本文件中执行 C# 代码。它确实运行了,但是没有智能感知支持。

【讨论】:

  • 我可以用 VS 2019 做同样的事情。添加了一个文本文件并重命名为 .csx 文件
【解决方案2】:

令人沮丧的是,这是不可能的。错误报告给微软。请添加您的投票。 https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/7848117-add-scriptcs-csx-intellisense-and-debugging-in-v

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 2012-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多