Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity Win32Exception: unity_csc.bat, "The system cannot find the file specified."

Discussion in 'Editor & General Support' started by unity_18melkumyanm, Feb 26, 2021.

  1. unity_18melkumyanm

    unity_18melkumyanm

    Joined:
    Mar 27, 2020
    Posts:
    7
    Hello!

    I've been butting heads with a Unity error this past week and have struggled to find a solution.

    "
    Win32Exception: ApplicationName='C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-b91d50f350c57bb438ca7ebd84b776dc', CurrentDirectory='', Native error= The system cannot find the file specified.

    System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    System.Diagnostics.Process.Start () (at <aa976c2104104b7ca9e1785715722c9d>:0)
    (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
    UnityEditor.Utils.Program.Start (System.EventHandler exitCallback) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Utils.Program.Start () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.BeginCompiling () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.QueuePendingAssemblies () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.Poll () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssembly[] scriptAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions, UnityEditor.Scripting.ScriptCompilation.EditorCompilation+CompileScriptAssembliesOptions compileScriptAssembliesOptions) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScriptsWithSettings (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.TargetAssembly[]& notCompiledTargetAssemblies, System.String[]& notCompiledScripts, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions editorScriptCompilationOptions, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform, System.String[] extraScriptingDefines, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+<>c__DisplayClass40_0.<CompileScriptsNoStop>b__0 () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[T] (System.Func`1[TResult] func, T returnValue) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileScriptsNoStop(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget, String[])
    "

    It's affecting all my unity projects and scenes right now. My game was working fine one day, but the next day this error just appeared and it seems unfixable. I've googled the error and the only similar threads I've found are this one, which is a similar but not quite the same error ("Access is Denied" instead of "The system cannot find the file specified."), and this thread, which had no working solutions for me.

    I've tried all of the following with no success:
    - Creating a new project, where the error persists even with no objects or scripts present (screenshot attached).
    - Uninstalling and reinstalling unity, including versions 2019.4.19, 2019.4.21, and 2020.2.6
    - Installing unity on a different drive
    - Clearing "C:\Users\[my user]\AppData\Local\Temp"
    - Turning off antivirus (windows defender in my case)
    - Going through task manager and deleting all non-essential processes ( I can provide a screenshot of the remaining ones if needed)
    - Double-checking file path for odd characters (such as " ' ")
    - Running unity as an administrator
    - Ensuring that "unity_csc.bat" has the correct file permissions
    - Double checking that "unity_csc.bat" is where it should be, and that it can be edited. Interesting to note that if I remove it from its folder then I get a separate error stating "Exception: 'C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat' not found. Is your Unity installation corrupted?" which tells me that it is in fact looking in the correct folder for the file.
    - Sending my project to my professor where he confirmed that it works on his computer, which tells me that the issue is something specific to my unity (even though I've done multiple fresh installs?).
    - Comparing my professor's "unity_csc.bat" to mine ('diff' says that they are identical).

    I'm basically bricked from using unity at this point. It even affects brand-new projects, meaning that I cannot escape it. I've been blocked from working on a class project this past week and am getting really frustrated at this point. Does anyone have any suggestions at all? And furthermore, is there a way that I can directly contact Unity support for an issue like this?

    Thank you!
     

    Attached Files:

    Last edited: Feb 27, 2021
  2. GilJoWal

    GilJoWal

    Joined:
    Mar 28, 2020
    Posts:
    26
    I have the same issue, please help
     
  3. KolyanJo

    KolyanJo

    Joined:
    Jun 11, 2020
    Posts:
    1
    similar situation
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The OP's other thread:
    https://forum.unity.com/threads/des...-due-to-win32exception-unity_csc-bat.1068617/

    The OP's issue was caused by some problem on his computer unable to launch "cmd", which is what is used by Windows to interpret .bat files. In the OP's case, the problem appears unrelated to Unity itself.

    If your problem has a different cause, I'd ask the same questions I did in my first comment in the linked thread.
     
  5. euivtui4h

    euivtui4h

    Joined:
    Aug 28, 2017
    Posts:
    4
    Fixed!
    My problem was the Antivirus (Avast :middlefinger:) quarantining that file.
    Fixed by adding and exception for this file and removing it from quarantine.
    I did reinstall Unity before stumbling on the AntiVirus
     
  6. Dineo0

    Dineo0

    Joined:
    Nov 26, 2021
    Posts:
    1
    I'm pretty sure it's being caused by another program, for me, I found that my installation of visual studio blocked unity
    I'm also sure when my installation finishes unity will get back to normal