Home » Development » Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe”

Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe”

When you publish your ASP.NET project to a hosting account such as GoDaddy, you may run into the issue below. This issue may occur even though your code works fine in localhost.

Server Error in ‘/’ Application.
.
Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
.
Parser Error Message: Cannot execute a program. The command being executed was “G:\PleskVhosts\website.com\httpdocs\bin\roslyn\csc.exe” /shared /keepalive:”10″ /noconfig  /fullpaths @”C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\4a4c810d\6d29243e\slpxwrhm.cmdline”.

Resolution

A simple solution for this issue is that removing Roslyn compiler plugin from your project and using old compiler. In order to remove Roslyn:
  1. Follow “Tools > NuGet Package Manager > Manage NuGet Packages for Solution” in Visual Studio
  2. Find “DotNetCompilerPlatform” and uninstall it

Source: https://social.msdn.microsoft.com/Forums/vstudio/en-US/442b100a-2b88-4ac4-b655-0c1345791f15/roslyn-cscexe-web-api-2-on-hosting-server?forum=msbuild

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

16 thoughts on “Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe””

  1. I am having the same kind of problem. I uninstalled DOTNETCOMPILERPLATFORM and republished, but the problem still remains
    Error message is below.

    [Win32Exception (0x80004005): This program is blocked by group policy. For more information, contact your system administrator]

    [ExternalException (0x80004005): Cannot execute a program. The command being executed was “G:\PleskVhosts\masterencryptor.com\httpdocs\bin\roslyn\vbc.exe” /shared /keepalive:”10″

    I am on Godaddy “shared” hosting and am being told that I need to go to a “non-shared” hosting plan to fix the problem.

    Reply

Leave a Comment