Today I’m pleased to announce that the Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2 package is released on NuGet. It enables ASP.NET to support the new language features and improves the compilation performance. To install this NuGet package, open NuGet Package Manager in visual studio, search Microsoft.CodeDom.Providers.DotNetCompilerPlatform and click Install/Update button.
What’s new in the new release
- Update the dependency package Microsoft.Net.Compilers to which is the latest RTM version of the Roslyn compiler. This new version addresses a performance issue with csc.exe on single core machines.
- Disable profiling when launching Roslyn compiler. the profiling is enabled on the w3wp.exe process, CLR will not load NGEN’d assembly which could slow down cold startup performance. The Roslyn compiler references several large assemblies and takes several seconds to start the Roslyn compiler process if those reference assemblies are not loaded from NGEN. This new version disables profiling when starting the compiler. If you do want to profile the Roslyn compiler, you can add the following appsetting entry in web.config.
<appSettings><add key="aspnet:DisableProfilingDuringCompilation" value="false"/></appSettings>
- Address an issue on GitHub which causes a compilation error. The root cause of the issue is that the Roslyn compiler assemblies are included as project items which are part of the “candidate assembly files”. In the error case, ResolveAssemblyReferences task resolves the reference assembly, namely System.Collections.Immutable.dll, to the one under Roslyn compiler folder which may be an older version than the project actually references. This new release fixes the issue.
Tips
Roslyn compiler references several large assemblies and it takes several seconds to load them all, as CLR needs to JIT them. So to get better performance (for a simple website, the cold startup is about 50% faster), it’s highly recommended to NGEN those assemblies. Here are the commands to do NGEN.
Ngen.exe install Microsoft.CodeAnalysis.CSharp.dll
Ngen.exe is under %SystemRoot%\Microsoft.Net\Framework\v4.0.30319 folder and you may want to NGEN all the managed assemblies in Roslyn compiler package.
Known issue
When you update Microsoft.CodeDom.Providers.DotNetCompilerPlatform nuget package you may see an error message similar to that in the image below when updating the Microsoft.Net.Compilers NuGet package. This happens because the Roslyn compiler process is still active and NuGet fails to uninstall the old one. To work around this issue, please restart Visual Studio and reinstall the package.
Feedback
If you find any issue or want to ask a question regarding what’s discussed in this article, please leave a comment below, or use the Contact Owners form for the NuGet package.