Visual Studio 2012 csc.exe error. The executable file is not valid for the OS

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

Error 1 Failed to execute the specified executable file for the task "Csc.exe". The specified executable file is not a valid application for this OS platform.

After testing a few sentences on the Internet, nothing fixed the problem. Does anyone know what causes this? Is there a new version of Csc.exe that I need to keep? I know that the compiler is simply not sure what I need to do to fix this problem.

+10
source share
10 answers

I had this exact problem today on my Win7 machine. As Hans suggests: "Go 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 the text of some errors. This indicates that your compiler has been destroyed. In my office, we came up with the theory that updating Windows could be the reason for this, because only a few machines are affected, but I still haven't read a lot online about it.

We fixed this by copying someone else csc.exe to the C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 directory and recompiling. Be sure to set the parameters in the read-only file so that this does not happen again. Good luck

+9
source

The problems associated with csc.exe in Visual Studio 2012 can be solved mainly by restoring Visual Studio.

You need to repair Visual Studio. Go to Control PanelPrograms . Then select your version of Visual Studio that you are using and click " Change " (or right-click and click " Change "). When the setting appears, click Restore .

+5
source

I am in Visual Studio 2017, but this is the first Google result that appears for "csc.exe not found"

When I received this error, I had to restart Visual Studio by selecting "Run as administrator". After that, everything worked

+1
source

Check the properties of your solution (right-click Solution and select "Properties") and make sure that the "platform" field is configured correctly.

0
source

I think this problem is caused by improper cleaning of the PC. I ran Quick Heal PCTuner 3.0 software on a 64-bit Windows 7 machine, but suddenly my machine was turned off due to power loss, and then when I opened it again, I got this problem in VS 2013. Even TortoiseSVN check did not work and causing an internal error and something like a damaged disk was also shown when trying to delete some files on the hard drive.

I started PC Tuner, again cleaning the disk, registry and traces, and it is fixed. this problem may also occur due to other cases, but is mainly related to system files. In my case, this fix

Sincerely.

0
source

helped in my case (I had .net framework 4.5.1 and vs C # 2010 express): download the latest .net infrastructure and start repair

0
source

In Visual Studio 2013, the same problem was solved by doing this for me: Right-click the solution and open Configuration Manager. . For a project (you can see at least one there), I changed the platform from Any CPU to x86 for a project that might cause a problem.

0
source

I tried to delete and move the csc.exe file, but it does nothing.

Then I just upgrade the .net version and then downgrade (it returns to its original state), and it works.

0
source

I ran into this problem while I try to move an Asp.Net Mvc Project from one computer to another; error message: 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 decided it

  • Creation of a new Mvc project;
  • go to this folder \ Microsoft.Net.Compilers.1.0.0 \ build .. \ tools
  • and copied the csc.exe file to my projects -> \ Microsoft.Net.Compilers.1.0.0 \ build .. \ tools \

I think when I copied the project from the source computer, I left the csc.exe file in the specified folder.

Hope this helps someone.

0
source

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

0
source

All Articles