ASP.NET项目中“Could not find a part of the path ... bin\roslyn\csc.exe”错误
大家好!我是C#和ASP.NET的新手,使用Visual Studio 2019。启动我的Web应用程序(ASP.NET MVC项目)时,突然遇到错误:
```
Could not find a part of the path 'D:\Projects\MyApp\MyApp\bin\roslyn\csc.exe'
```
项目之前运行正常,但在添加NuGet包Microsoft.CodeDom.Providers.DotNetCompilerPlatform并更新解决方案后,错误持续出现。这是我的代码(简单控制器):
```csharp
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
```
我已经尝试过:
1. 清理并重新生成解决方案(Build -> Clean Solution,然后Rebuild)。
2. 手动删除bin和obj文件夹。
3. 重新安装Visual Studio(没有帮助)。
错误在编译Razor视图时出现。bin\roslyn文件夹中确实没有csc.exe文件。如何修复?请帮忙!
<<>>
错误原因
错误是由于包