Skip to content

Problem with configuration of C# Script 'Compiler executable file csc.exe cannot be found - C# Script'

David Halliday

Asked Oct 23, 2008, 5:20 AM EDT1 answer
Share
LinkedInX
I have a script that has been used on other servers without issue that relies on C# Script to perform automated tasks. I recently have tried to transfer this to a new server and have been getting the following error when I try to run any scripts:

Code
See the end of this message for details on invoking
Code
just-in-time (JIT) debugging instead of this dialog box.
Code
************** Exception Text **************
Code
System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
Code
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
Code
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
Code
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
Code
   at csscript.CSExecutor.Compile(String scriptFileName)
Code
   at csscript.CSExecutor.Compile(String scriptFile, String assemblyFile, Boolean debugBuild)
Code
   at CSScriptLibrary.CSScript.Load(String scriptFile, String assemblyFile, Boolean debugBuild, String[] refAssemblies)
Code
   at CSScriptLibrary.CSScript.LoadCode(String scriptText, String assemblyFile, Boolean debugBuild, String[] refAssemblies)
Code
   at CSSScript.ShellExForm.Initialise()
Code
   at CSSScript.ShellExForm..ctor(Boolean readOnlyMode)
Code
   at Config.ConfigForm.ConfigForm_Load(Object sender, EventArgs e)
Code
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
Code
   at System.Windows.Forms.Form.OnCreateControl()
Code
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
Code
   at System.Windows.Forms.Control.CreateControl()
Code
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
Code
   at System.Windows.Forms.Control.WndProc(Message& m)
Code
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
Code
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
Code
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
Code
   at System.Windows.Forms.Form.WndProc(Message& m)
Code
   at Config.ConfigForm.WndProc(Message& m)
Code
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
Code
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
Code
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Code
Code
************** Loaded Assemblies **************
Code
mscorlib
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
Code
----------------------------------------
Code
css_config
Code
    Assembly Version: 0.0.0.0
Code
    Win32 Version: 0.0.0.0
Code
    CodeBase: file:///C:/Scripts/cs-script/css_config.exe
Code
----------------------------------------
Code
System.Windows.Forms
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
Code
----------------------------------------
Code
System
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
Code
----------------------------------------
Code
System.Drawing
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
Code
----------------------------------------
Code
csws
Code
    Assembly Version: 2.2.0.0
Code
    Win32 Version: 2.2.0.0
Code
    CodeBase: file:///C:/Scripts/cs-script/csws.EXE
Code
----------------------------------------
Code
System.Xml
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
Code
----------------------------------------
Code
config
Code
    Assembly Version: 0.0.0.0
Code
    Win32 Version: 0.0.0.0
Code
    CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Temp/1/CSSCRIPT/Cache/1175209938/config.csc
Code
----------------------------------------
Code
CSScriptLibrary
Code
    Assembly Version: 2.2.0.0
Code
    Win32 Version: 2.2.0.0
Code
    CodeBase: file:///C:/Scripts/cs-script/lib/CSScriptLibrary.dll
Code
----------------------------------------
Code
System.Design
Code
    Assembly Version: 2.0.0.0
Code
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
Code
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
Code
----------------------------------------
Code
************** JIT Debugging **************
Code
To enable just-in-time (JIT) debugging, the .config file for this
Code
application or computer (machine.config) must have the
Code
jitDebugging value set in the system.windows.forms section.
Code
The application must also be compiled with debugging
Code
enabled.
Code
For example:
Code
<configuration>
Code
    <system.windows.forms jitDebugging="true" />
Code
</configuration>
Code
When JIT debugging is enabled, any unhandled exception
Code
will be sent to the JIT debugger registered on the computer
Code
rather than be handled by this dialog box.

The .NET libraries are installed and I can navigate to the file csc.exe without issue. I am compleatly lost as where to look on this. After googling for a long time I haven't found anyone with the same problem. Most answers refer to this with issues of using .NET 3 and this has always been used with .NET 2 on our other servers.

I have used the .NET Framework Setup Verification Utility which has told me:
Product: .NET Framework 2.0 SP1
Status: Verification Succeeded

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    Found what the problem was. I needed to install the .NET SDK http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec
    +1