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

后端 未结 9 706
不思量自难忘°
不思量自难忘° 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:10

    None of the previous answers worked for me.

    The problem was that I didn't have the .NET Compiler Platform SDK installed.

    To solve, open Visual Studio Installer, choose "Modify", and under the "Invididual Component" tab, check the .NET Compiler Platform SDK, and confirm your changes by clicking "Modify".

    After I installed it and reopened Visual Studio, the problem is gone.

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

    Close down all instances of Visual Studio. Then reopen the solution and rebuild.

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

    I had the same issue after I upgraded Microsoft.Net.Compiler from 2.8.2 to 2.9.0. After I downgraded to 2.8.2 projects compiled without any errors.

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

    I uninstalled both Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers and everything now works.

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

    I do not like removing packages without first understanding what I'm removing. I faced the same problem with my solution.

    I discovered that 1 of the many projects was using the Microsoft.Net.Compilers NuGet package - let's call it Project ABC. A Unit Test project was referencing that Project ABC, but not the Microsoft.Net.Compilers NuGet package.

    I simply referenced the Microsoft.Net.Compilers NuGet package from my Unit Test project, and the problem has now gone away.

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

    In my case I could go from Microsoft.Net.Compilers 2.4.0 to Microsoft.Net.Compilers 2.10.0. No need to use Microsoft.Net.Compilers 2.8.2.

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