c# - 无法加载文件或程序集 'System.Security.Principal.Windows'

标签 c# asp.net

解决方案已经编译成功,但是我在项目中添加一个已经存在的类文件后,出现了这个错误:

The specified task executable "csc.exe" could not be run. Could not load file or assembly 'System.Security.Principal.Windows, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. MvcApplicationRegister

我通过 NuGet 安装了 System.Security.Principal.Windows 包,但仍然出现错误。

最佳答案

之前的答案都不适合我。

问题是我没有安装 .NET Compiler Platform SDK。

要解决,请打开 Visual Studio 安装程序,选择“修改”,然后在“单个组件”选项卡下,选中 .NET Compiler Platform SDK,然后单击“修改”确认您的更改。

enter image description here

我安装它并重新打开 Visual Studio 后,问题就消失了。

关于c# - 无法加载文件或程序集 'System.Security.Principal.Windows',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51909212/

相关文章:

c# - 从 xhtml 文档中删除未关闭的开始 <p> 标签

asp.net - 如何在ASP.NET请求生命周期中处理异常

ASP.NET MVC 经验/成功案例 [2010]

javascript - ASP。 NET Controller 接收空数组

asp.net - ReportViewer 正在阻止其他功能,直到报表查看器的加载完成

c# - 在检查 http 状态代码时收到错误消息 - 远程服务器返回错误 : (503) Server Unavailable

c# - 一个充满已定义字符串的类正常吗?

C# + 以编程方式使用事件处理程序

c# - 单击一行时如何从 GridView 重定向

asp.net - ItemIndex asp :Repeater VB. NET 的内联 IF 语句