![](/img/trans.png)
[英]Is there a way to use Microsoft.CodeDom.Providers.DotNetCompilerPlatform without a nuget package?
[英]csc.exe compilation time degradation when “Microsoft.CodeDom.Providers.DotNetCompilerPlatform” package is used
我們的團隊目前正在從C#5.0遷移到C#6.0語法,因此應使用Roslyn編譯器而不是舊版編譯器。
我們必須在復雜的解決方案編譯過程中使用“ csc.exe”。 生成命令如下所示:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe -nologo -target:library -out:c:\repo\bin64\deb\common.dll @.\rspE0FF.tmp
該命令執行大約需要400ms
“ rspE0FF.tmp”內容看起來像這樣(它包含更多* .cs文件,但是,沒關系,這在任何文件集上都可以重現):
"c:\repo\shared\common\estimation\complexjob.cs"
"c:\repo\shared\common\stringdecorator.cs"
"c:\repo\shared\common\tplextensions.cs"
"/reference:mscorlib.dll" "/reference:System.dll" "/reference:System.Data.dll" "/reference:System.Xml.dll" "/reference:System.ServiceModel.Activation.dll" "/reference:System.IdentityModel.dll" "/reference:System.Data.Entity.dll"
當使用Roslyn編譯器時,執行時間喊到〜4100ms。命令是相同的,只是從包文件夾中調用csc.exe:
c:\NewRepo\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\tools\RoslynLatest\csc.exe -nologo -target:library -out:c:\repo\bin64\deb\common.dll @.\rspE0FF.tmp
我們必須通過依次運行數百個csc.exe命令來構建解決方案。 總編譯時間從2分鍾增加到8分鍾。
是否會導致性能下降?
關於如何進行調整的任何建議?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.