在旧的.net中,我们曾经能够运行csc编译器来编译单个cs文件或多个文件.使用.net核心,我们csc坚持拥有一个合适的项目文件.是否有一个独立的命令行编译器,它允许编译源代码文件而无需项目(并列出在同一命令行上引用的依赖项)?
在Linux上,当我安装了旧的csc和新的.net核心时,我得到了这些时间:
[root@li1742-80 test]# time dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
test -> /root/test/bin/Debug/netcoreapp2.0/test.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.94
real 0m7.027s
user 0m5.714s
sys 0m0.838s
[root@li1742-80 test]# time csc Program.cs
Microsoft (R) Visual C# Compiler version 2.3.0.61801 (3722bb71)
Copyright (C) Microsoft Corporation. All rights reserved.
real 0m0.613s
user 0m0.522s
sys 0m0.071s
[root@li1742-80 test]#
Run Code Online (Sandbox Code Playgroud)
使用.net核心注意7秒,使用旧csc注意几百毫秒dotnet build.
我希望能够使用.net核心快速编译,因为我曾经能够使用csc.