Could not load file or assembly 'System.Security.Principal.Windows'

后端 未结 9 708
不思量自难忘°
不思量自难忘° 2021-02-06 20:29

Solution has compiled successfully, but after I added an existing class file to the project, this error appeared:

The specified task executable \"csc.exe\

相关标签:
9条回答
  • 2021-02-06 21:24

    Had this same issue and resolved it.

    In a 3 project solution MVC controller (Web,Business,Data)

    Caused by the Microsoft.Net.Compiler 2.9.0 being installed on the Web project but not the other projects.

    To resolve: Right click the solution. Manage NuGet Packages. Installed > Search for the compiler Ensure it is the same version and it is installed on all projects in your solution

    Once installed my solution built successfully

    0 讨论(0)
  • 2021-02-06 21:25

    If you are using Microsoft.CodeDom.Providers.DotNetCompilerPlatform you can upgrade to 2.x and then remove Microsoft.Net.Compilers as it's no longer needed. That solved it for me, however I couldn't even build the solution in the first place. It was still complaining about System.Security.Principal.Windows though, I could also solve it by referencing System.Security as an assembly. It's not recommended though.

    0 讨论(0)
  • 2021-02-06 21:25

    Updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform and deleting Microsoft.Net.Compilers worked for me.

    0 讨论(0)
提交回复
热议问题