Ahron Moshe Galitzky Ahron Moshe Galitzky - 1 year ago 157
ASP.NET (C#) Question

Problems publishing a website on smarterasp.net with csc.exe file included?

I am using Microsoft Visual Studio 2015, I built a simple website with a C# contact form.
When I compile and run on localhost it works perfectly fine. However, when I try to publish it (on smarterasp.net) I am getting an error:

[Win32Exception (0x80004005): Access is denied]

[ExternalException (0x80004005): Cannot execute a program. The command being executed was "..\bin\roslyn\csc.exe"

I have contacted smarterasp.net and they said they dont allow .exe files. I tried to delete csc.exe with ftp from the server but when I do that I am getting the error:

Could not find file "..\bin\roslyn\csc.exe".

How can I solve this issue with the csc.exe that is trying to get included in my project so I can get my this website published?

Answer Source

After hours of researching i came up with the solution.

Since the .NET 4.5 version, Roslyn compilation is the default way of compiling. This means if you create any web application either Web Forms or MVC using .NET 4.5 you get this Roslyn csc.exe compilation pre-installed in your project.

Basically what i needed was to compile and deploy my project without Roslyn or any .exe files on it.

So here is the Solution that worked for me. You can deploy without Roslyn with no change in code:

  1. Open NuGet Package Manager window
  2. uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform package and rebuild & republish. (This uninstallation also removes CodeDom configuration from web.config file.)

This will solve your purpose. Basically this will not generate any csc.exe, vbc.exe files inside bin folder.

I hope it works for you too!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download