Recently I change my development environment and come across the following issue while browsing the website on localhost
The CodeDom provider type “Microsoft. CodeDom. Providers. DotNetCompilerPlatform. CSharpCodeProvider, Microsoft. CodeDom. Providers. DotNetCompilerPlatform, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35” could not be located.
When I investigate this issue it turns out the project has Roslyn reference which the new environment’s IIS does not support.
The solution is very simple, If you reinstall the DotNetCompilerPlatform Nuget package it will resolve the issue.
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r