Question

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.

Was it helpful?

Solution

I had this exact problem today on my Win7 Machine. As Hans suggests, 'Navigate to C:\Windows\Microsoft.NET\Framework\v4.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:\Windows\Microsoft.NET\Framework\v4.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!

OTHER TIPS

The problems associated with csc.exe in Visual Studio 2012 can mostly be solved by repairing Visual Studio.

You need to repair Visual Studio. Go to Control Panel -> Programs. Then select your version of Visual Studio you are using and press "Change"(or right click it and press "Change"). When the setup appears, click "Repair".

I am on Visual Studio 2017 but this is the first google result that pops up for "csc.exe not found"

When I got this error I had to restart Visual Studio, being sure to select 'Run As Administrator'. Everything worked after that

I've faced this problem while i am trying to move Asp.Net Mvc Project from one computer to another ; error message was : The specified task executable location "c:\users\mypcname\documents\visual studio 2015\Projects\TestMVC\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\csc.exe" is invalid. I solved this by

  1. Creating new Mvc Project ;
  2. going to that folder \Microsoft.Net.Compilers.1.0.0\build..\tools
  3. and Copied the csc.exe file to my Projets >> \Microsoft.Net.Compilers.1.0.0\build..\tools\

i think when i was copying the project from the original Computer i left that csc.exe file in the specified folder.

Hope this will help someone.

Check your solution properties (right-click on Solution and select 'Properties') and make sure that the 'platform' field (Configuration Properties) is set correctly.

I think this problem is caused due to improper PC clean up. I was running Quick Heal PCTuner 3.0 software on a 64-bit windows 7 machine but suddenly due to loss of power my machine was shut down then when i opened it again I was getting this problem in VS 2013. Even TortoiseSVN checkout was not working and throwing internal error and something like corrupted disk also was shown when trying to delete some files on the harddisk.

I ran the PC Tuner again doing the Disk, Registry and traces clean up and it got fixed. maybe this problem may occur due to other cases also but is mostly related to the system's files In my case this is the fix

Regards.

in my case helped (I had .net framework 4.5.1 and vs c# 2010 express): download the newest .net framework and run repair

On Visual Studio 2013, the same problem solved by doing this for me: Right click the solution and open Configuration Manager. For the project(you may see at least one there), I've changed the Platform from Any CPU to x86 for the project that may causing the problem.

I've tried to delete and move csc.exe file but it doesn't do anything.

Then simply I upgrade .net version and than downgrade (returned to its original state) and it works.

I solved my problem by copying the whole folder containing my visual studio solution From C:\Users\me\Google Drive... To: C:\Users\me\OneDrive...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top