How to solve – Could not find a part of the path bin roslyn csc.exe error
If you are trying to run Asp.Net application and getting given error in your browser even after successfully build and compile without getting any error.
Don’t worry! this is all happening because your build is trying to find because
\bin\roslyn\csc.exe the following packages have been added to your project. Just review your
packages.config file, you can have both of them there.
Why Roslyn and what is the use of Roslyn in Visual Studio
If you are running your project using .net Framework 4.5.2 with Visual Studio 2015/2017, you might have noticed that the project templates using Roslyn by default. Actually, Roslyn provides open-source C# and Visual Basic compilers with rich code analysis APIs. It enables building code analysis tools with the same APIs that are used by Visual Studio.
Read more about Roslyn :
When to use Roslyn
If your project having Roslyn references and you are going to deploy it no server, you will get unexpected errors on the website as many hosting providers still have not upgraded their servers and hence do not support Roslyn. To resolve this issue, you will need to Downgrading it or remove the Roslyn compiler from the project template.
Way 1 : Run below code in the Package Manager Console to re-install/upgrade Nuget packages:
if you are not interested in using Roslyn, follow steps below to delete it
Way 2 : Remove Nuget packages, use the below commands from Nuget Package Console
After executing above command in Package Console, your web.config file should be auto-updated. In case it is not, look for the below code in web.config file and if it is found, delete this piece of code.
Try above steps to solve the issue if you are getting a similar error.