在旧的.NET中,我们曾经能够运行csc
编译器来编译单个或多个.cs文件。
有了.NET核心,我们有了dotnet build
,它坚持要有一个合适的项目文件。有没有一个独立的命令行编译器,可以在没有项目的情况下编译源代码文件(并在同一命令行中列出引用的依赖项)?
在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]#
注意,对于相同的文件Program.cs
,使用.NET核心的时间为7秒,而使用旧csc
的时间为几百毫秒。
我希望能够像以前使用csc
一样快速地使用.NET核心进行编译。
https://stackoverflow.com/questions/46065777
复制相似问题