12

Getting a csc.exe error with the .NET samples from the site. Running in a Windows 10 x64 environment; projects came in as Win 8 and were required to be retargeted to 8.1. Now the projects don't build. Turned on diagnostics logging to get the detail. Is there a way to get the full command line that is being invoked on build?

Description "csc.exe" exited with code -532462766. Project File C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets Line 246

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
dr3x
  • 917
  • 2
  • 14
  • 26
  • 1
    this is a generic CLR exception code 0xE0434352. capture a crash dump of csc.exe (procdump -ma -i C:\dumps) and analyze it with windbg (at end of this link: http://ig2600.blogspot.de/2009/07/finding-clr-exceptions-with-visual.html) – magicandre1981 Dec 02 '15 at 05:18
  • 2
    `Delete the bin and obj folder in project(s). The try to clean and rebuild the solution` – Krsna Kishore Dec 02 '15 at 05:35
  • I have the exact same error with a similar setup. Were you able to solve this issue? There is very little info about it online. – Xavier Peña Jan 05 '16 at 19:56
  • In my case it might look like it is a compiler error that is not recognized by Visual Studio. Other projects work just fine, but after applying a big refactoring to the project I'm working on this error suddenly happened and it won't go away. – Xavier Peña Jan 05 '16 at 21:38
  • Nevermind, I have solved it by re-doing the refactoring from scratch. This time it works perfectly. – Xavier Peña Jan 06 '16 at 00:20
  • I cleaned the project that caused the error, and then it worked. MS works in mysterious ways :P – Jaques Apr 20 '17 at 11:36

8 Answers8

18
Install-Package Microsoft.Net.Compilers -Version 1.2.1 

Worked for me!

yeulucay
  • 434
  • 8
  • 17
  • This worked for me, although the version number i was at was 1.2.2 and i went up to 1.3.2. Apparently microsoft likes to keep breaking things in their compilers. – Jamie M Aug 02 '16 at 15:21
  • Well, i installed 1.3.2 version through "Manage NuGet Packages for Solution". Error changed to ""csc.exe" exited with code 255". Still searching for solution. – Archont Dec 21 '16 at 07:22
  • Did you check your references? Is it still 1.0.0 or changed? – yeulucay Dec 22 '16 at 09:01
  • Worked for me too, I had updated one project to .net 4.6.1 when it was 4.5 along with it's sister projects. Used the latest version 1.3.2 – Brendon Colburn Jul 25 '17 at 01:14
  • @IuriFarenzena When I send this answer, latest version was 1.2.1. If you don't specify a version, it brings the latest version and solves the problem too. – yeulucay Feb 09 '18 at 06:59
  • Be sure to look up the correct version for the version of the .Net Framework you are using. You can find more information at https://www.nuget.org/packages/Microsoft.Net.Compilers/ – tdbeckett Feb 18 '20 at 13:36
  • When I post the message, I guess the existing version was 1.2.1 that's why I typed it statically. Sure, you should check the appropriate version for your app. you are right @tdbeckett – yeulucay Apr 26 '20 at 15:01
  • Worked for me too. I didn't specify any version and installed the latest Install-Package Microsoft.Net.Compilers – Shammie Oct 05 '20 at 19:57
4

This error can be generated by NuGet packages when some .dll are not available.

Delete packages folder and compile. It should restore all the NuGet packages.

Tonatio
  • 4,026
  • 35
  • 24
0

I couldn't find out the reason of this, but a rollback of project settings to default solved the case for me. I guess Visual Studio 2015 somehow mixed up it's settings.

Archont
  • 101
  • 1
  • 9
0

Go to tools -> options -> projects and solutions -> build and run

and change both MSBuild project build output verbosity and MSBuild project build log file verbosity verbosity levels to Normal, build your project again and watch the output window, if nothing new shows up change verbosity level to a higher one.

Rodrigo Alencar
  • 149
  • 2
  • 5
0

so easy, you just have to delete folder "bin" in your project and restart visual studio

Worked for me!

finderMan
  • 11
  • 1
  • 2
0

This was happening to me yesterday.

Not sure if it was related, but this problem started for me soon after a /bin and /obj folder delete to cure another build issue.

I tried every suggestion on here and elsewhere, but in the end the only thing that worked was closing all my code files that were open in the IDE. Seems bonkers to me that this is really the cure, but if it saves someone 6 hours of their life then it's worth a shot.

-3

If you are getting this error:

Error 10 "Csc.exe" exited with code -1073741801

Try to execute the command on nuget packgae console:

Install-Package NuGetEnablePackageRestore 
Andrei
  • 42,814
  • 35
  • 154
  • 218
Nilanjan Saha
  • 451
  • 4
  • 6
-3

try to delete "packages.config" it's worked with me.

  • At least provide the path to where the file lives. And is there a reason why this file should be deleted? Is the user going to lose any possible data on deleting this file. Your answer would be useful if you can improve it a little bit. – Shakti Prakash Singh Mar 12 '17 at 22:46