Error while running C# project: The specified task executable location "\\csc.exe" is invalid

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jvincek
:warning: Old Version Published before Godot 3 was released.

As specified in the title, I get this error while trying to run a C# project:

The specified task executable location “\csc.exe” is invalid.

Click to see error SS

This happens after fixing the error I previously had with reference assemblies.

I must admit I’m a bit confused. Isn’t the point of Mono so that you don’t need the “regular” .NET framework? Because to fix the first error I had to install the correct .NET SDK version and now the compiler “csc” can’t be found. I have “csc.exe” in a bunch of locations, both in C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe (for multiple versions in this location), and in Mono itself: C:\Program Files (x86)\Mono\lib\mono\4.5

Which one is it looking for? Why can’t it find it (godot/mono/toolchain, whichever is failing)?

I have both of these locations in the PATH env. var. but the file path in the error report (two backslashes with csc.exe) looks suspicious…

Any update to this that you’ve found? I have the same problem, and came from the previous problem that you had involving the reference assemblies.

rockretep | 2017-11-20 19:23

Sorry, I have yet to find the solution to this problem. I tried installing Godot on another machine and had the exact same situation (both the previous issue and this one). By the number of upvotes, it seems we’re not alone :slight_smile:

I have failed to figure out who/what has (or provides) the incorrect csc executable location (“\csc.exe”). Googling this seems to only reveal similar problems where “incorrect” csc either has a full path which gives further hints on how to proceed or as it turns out csc can sometimes be corrupted which is solved by reinstalling it.

But I haven’t found this exact same problem or how to fix it.

jvincek | 2017-11-20 20:48

As an update to this problem, I just tried installing Godot_v3.0-alpha2_mono_win64 and Mono-5.4.1.6-x64-0 on an new machine with nothing installed on it related to .NET, Mono, or Godot, and the same prior problem with reference assemblies happened. I think there is either something missing that’s assumed we should have/do in order to get this working, or there is something wrong with the Godot alpha2_mono binary that prevents it from correctly building a solution.

I’m not very knowledgeable on this topic, so I could definitely be missing something here.

rockretep | 2017-11-22 17:21

Yes, pretty much my exact thoughts. The beta is supposed to arrive in a few days (it’s stated in today’s post about translations), so I’ll wait for that to see if the problem is resolved. If not I’ll try to reach out to someone from Godot team to see if someone can help.

jvincek | 2017-11-22 22:38

:bust_in_silhouette: Reply From: Akrasia

Have you tried the following?

Editor > Editor Settings > Mono > Builds

Set Build Tool to MSBuild(System)

Tried it, didn’t work. I’ve selected the answer that helped, but thanks for your answer.

jvincek | 2017-11-23 23:53

:bust_in_silhouette: Reply From: mayotuna

I had the same problem, but installing MSBuild 2015 fixed it for me:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=48159

I can confirm that this also solved the problem for me. Hopefully no more problems creep up :slight_smile:
Thanks.

jvincek | 2017-11-23 23:51