前言
最近直接透過 Visual Studio 2017 新增專案後,建置都成功。
但直接執行時,卻出現以下的錯誤訊息,
Server Error in ‘/‘ Application.
Could not find a part of the path ‘C:\Users...\bin\roslyn\csc.exe’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\Users...\bin\roslyn\csc.exe’.
解法
1.更新 Microsoft.CodeDom.Providers.DotNetCompilerPlatform package
依Error: Could not find a part of the path ‘E:\sitesroot\0\bin\roslyn\csc.exe’.是 Microsoft.CodeDom.Providers.DotNetCompilerPlatform package 的 Bug,所以更新到最新版本就可以了,如下,