dotnet CLI 运行没有 cs 文件的单个字符串,如 dotnet run "System.Console(DateTime.Now);"在 linux 上

问题描述

dotnet CLI 是否有可能在没有任何文件编译器的情况下运行单个字符串,例如:dotnet run "System.Console(DateTime.Now);",并获取消息 2021-02-14Txx:xx:xx.xx

解决方法

当前 .NET 5 默认没有交互模式。 检查此工具的官方存储库以在 Jupyter Notebook 上运行交互式 C# 代码

https://github.com/dotnet/interactive