Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
561 views
in Technique[技术] by (71.8m points)

c# - Visual Studio 2012 csc.exe Error. Executable not valid for OS

I am getting the following error when trying to compile and test any type of project in Visual Studio 2012 Professional.

Error 1 The specified task executable "Csc.exe" could not be run. The specified executable is not a valid application for this OS platform.

After testing multiple suggestions online nothing has fixed the problem. Anyone know what is causing this? Is there a new version of Csc.exe I need to get a hold of? I know this is the compiler just not sure what I need to do to fix the problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had this exact problem today on my Win7 Machine. As Hans suggests, 'Navigate to C:WindowsMicrosoft.NETFrameworkv4.0.30319 and type "csc".'

The file may still exist but if you can open it with notepad, it will probably show just plain text of some errors. This is the indication that your compiler has been destroyed. At my office we have come up with a theory that a Windows update may be causing this because only a few machines have been affected, but I haven't read much online about it until now.

We fixed this by copying someone else's csc.exe into the C:WindowsMicrosoft.NETFrameworkv4.0.30319 directory and recompiling. Be sure to set the options on the file to read-only so this won't happen again. Good Luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...