Publish website without roslyn

Visual StudioVisual Studio-2015Roslyn

Visual Studio Problem Overview


I am trying to create web application using Visual Studio 2015 and .NET 4.5.1. When I publish the website, visual studio create folder named roslyn.

enter image description here

I know it's used to compile code on the fly, but unfortunately my hosting provider doesn't allow me to execute the compiler on their server.

How to publish the website without roslyn like previous version of Visual Studio?

EDIT: I got this error when trying to acces my website.

enter image description here

It seems IIS trying to execute roslyn\csc.exe but my user account doesn't have permission to do that. With previous version of Visual Studio, this error doesn't show up.

Visual Studio Solutions


Solution 1 - Visual Studio

I've just faced the same problem. When you create a new web project, two nuget packages automatically added to your project. If you remove them, your problem should be solved. Package names are: "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" and "Microsoft.Net.Compilers".

Solution 2 - Visual Studio

I had the same issue. Followed the steps from here. Basically:

  1. Uninstall the package

     Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform <Your Web API project name>
    
  2. In your publish profile settings, uncheck "Allow precompiled site to be updatable". You can find this under Settings > Precompile during publishing > configure

Solution 3 - Visual Studio

After searching the same issued I face, I just came here. I read the above answer which is right.

I give the answer, because of Here is the good article to explain :

  1. Why the publish code have this exe as well as development environment ?
  2. What is the benefit and how to remove?

This is also the very good article, about the history of this exe

Solution 4 - Visual Studio

After countless effort....and according to this website. I find that you can use /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false in MSBuild to transform web.config, this also include the roslyn compiler in the build. The output is same as what you get by publishing in Visual Studio into file system

Solution 5 - Visual Studio

There is an open bug on the roslyn repository about this issue.

In my case all I had to do was to downgrade the dll Microsoft.CodeDom.Providers.DotNetCompilerPlatform from version 1.0.6 to 1.0.5.

Solution 6 - Visual Studio

I have had the same issue in Sept2016 when I took over an existing ASP.NET program. I found that there were multiple versions of the two compiler packages mentioned by Kemal installed in different projects of the solution.

So firstly I updated to get them the same. VS doesn't tell you that updates are available in this scenario (or maybe I missed them ?)

I then had to restart VS2015 for the packages to clean up properly.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNiyokoView Question on Stackoverflow
Solution 1 - Visual StudioKemal KefeliView Answer on Stackoverflow
Solution 2 - Visual StudioMidasView Answer on Stackoverflow
Solution 3 - Visual StudioAjay2707View Answer on Stackoverflow
Solution 4 - Visual Studiocode4jView Answer on Stackoverflow
Solution 5 - Visual StudioFelipe MiossoView Answer on Stackoverflow
Solution 6 - Visual StudioRob Von NesselrodeView Answer on Stackoverflow