Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 650
Ahron M. Galitzky Avatar asked Feb 03 '16 18:02

Ahron M. Galitzky


People also ask

Is CSC an EXE?

The genuine csc.exe file is a legitimate software component of Microsoft . NET Framework signed by Microsoft Corporation. CSC stands for Visual C# [sharp] Command-Line Compiler. Note: The csc.exe can also be the principal executable for Comodo System Cleaner.

How do I publish a Visual Studio project?

To publish from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.


1 Answers

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!

like image 140
Ahron M. Galitzky Avatar answered Sep 20 '22 09:09

Ahron M. Galitzky