16

I have tried all solutions from other posts

This simple web application works on my laptop: windows 10/ VS-2015

Deploying to my WIN-2012 server gives this error:

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: The compiler failed with error code 255.

None of the solutions from other SO posts have helped.

Show Detailed Compiler Output:

c:\windows\system32\inetsrv> "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\vbc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\assembly\dl3\e9f43226\00c8c33b_c72ad101\OC.Web2.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\assembly\dl3\c13fc534\00128170_db94d001\Microsoft.AspNet.FriendlyUrls.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\assembly\dl3\8ff134f9\00fd38bf_4821d101\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\assembly\dl3\7686bcd0\001d3ec6_4198d001\Newtonsoft.Json.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\assembly\dl3\5993785e\00cabc17_4a21d101\AspNet.ScriptManager.jQuery.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /out:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\App_global.asax.v_2hcqbe.dll" /D:DEBUG=1 /debug+ /nowarn:41008,40000,40008 /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Collections.Specialized,System.ComponentModel.DataAnnotations,System.Configuration,System.Linq,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.DynamicData,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls,System.Xml.Linq /warnaserror- /optionInfer+  "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\App_global.asax.v_2hcqbe.0.vb" "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\oc\88c6cdde\6b37fcc6\App_global.asax.v_2hcqbe.1.vb"
johnnyRose
  • 7,310
  • 17
  • 40
  • 61
Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157

12 Answers12

48

Remove the compilers tag from the web.config file:

<compilers>
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,  Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"  type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,     Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0,     Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4"     compilerOptions="/langversion:14 /nowarn:41008     /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
johnnyRose
  • 7,310
  • 17
  • 40
  • 61
Meer
  • 656
  • 9
  • 18
14

The solution was working locally for me but from server I was getting this error 'The compiler failed with error code 255'.

It worked for me by uninstalling the nuget package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform' from my solution and redeploying.

Ganesh
  • 181
  • 1
  • 5
  • 3
    This solved the problem for me. My error said 'Compiler Error Message The compiler failed with error code -532462766', but the solution was the same – Anytoe Jul 14 '17 at 10:49
  • 3
    `The compiler failed with error code -2146232576.` Also is fixed by removing this package. – Thoughtful Dragon Jul 20 '17 at 15:08
9

I'm running Win2k12 R2 as a desktop OS and yesterday upgraded vs2k13 to vs2k15 after which some of my .NET 4.5 web applications stopped working with the above error "The compiler failed with error code 255", a bit of Googling and I came up with the below;

https://support.microsoft.com/en-us/kb/3118750

I was scenario #2 in the above article - ultimately I just uninstalled KB3098779 and KB3097997, rebooted and the applications worked again, happy days.

johnnyRose
  • 7,310
  • 17
  • 40
  • 61
alv
  • 1,037
  • 12
  • 15
  • I have reinstalled my server from scratch. I will apply all update packs and carefully add just the server roles i need. if i have same issues, then i will resort to removing these two KBs you have listed. Thanks – Charles Okwuagwu Dec 01 '15 at 14:51
  • 3
    Out of memory? -- I received this error on a low-specced virtual server I'm deploying to as a demo site for a client. I closed all the apps I had open in an RDC session (including Chrome!). With no other changes the site worked immediately. This leads me to believe it was a memory error. – ItsJason Mar 22 '16 at 02:04
  • My issue was a – JoshYates1980 Sep 07 '16 at 18:56
6

Moving project to .net 4.6.1 helps as well.

deathgore
  • 71
  • 1
  • 2
5

I just right click on solution and selected "Clean solution" and clicked. this worked for me.

garish
  • 637
  • 12
  • 14
2

For me, it got fixed after removing all references related to applicationInsights and deleting all files from packages.

Vishnu
  • 2,135
  • 2
  • 30
  • 51
2

Same issue. Solved by deleting and re-creating the website in IIS.

Fiach Reid
  • 6,149
  • 2
  • 30
  • 34
1

In my case I had to reinstall nuget packages.. Update-Package -reinstall

I had 255 error coming back every couple of rebuilds. Deleting temp & obj folders, restaring IIS was just a temporary help. Luckily I found name of some nuget packages in Compiler Output, which guided me to another try..

Bartek KG
  • 41
  • 4
1

If you remove the following Roslyn related packages, it may would solve your problem.

Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers

I could deal with the issue I was being faced with.

You can find my solution here.

Siyavash Hamdi
  • 2,764
  • 2
  • 21
  • 32
1

Just throwing in my two-cent answer for what may be an obvious solution in case anyone else runs into this...

For me, this happened after I updated the DotNetCompilerPlatform used in our project, but it worked fine on my dev machine - it was when I tried to deploy to our production server that I started receiving this error.

None of the other answers made sense in my case - I didn't have NuGet on the production machine, and I couldn't clean the solution, etc. However I did discover that CSC.EXE couldn't even run at all - it was throwing a TypeLoadException when executed from the command line. Rebooting didn't work either.

Fortunately the answer was simple - the synchronization tool that I was using to copy files to the production server was excluding EXE files, and thus the new CSC.EXE (and a few other files) did not get deployed. Once I deployed the correct version of the CSC.EXE it worked fine. I also verified it by running CSC.EXE -version

Michael Bray
  • 14,998
  • 7
  • 42
  • 68
0

Restarting the server (win-2012) solved the problem.

Eyal
  • 4,653
  • 9
  • 40
  • 56
0

I seem to get those errors when I try to attach the debugger to the application while it's still starting.

When I get this error (either The compiler failed with error code 1. or The compiler failed with error code 255.), I do the following:

  • Clean Solution,
  • Stop the App Pool,
  • Build Solution,
  • Start the App Pool.

Then I let the application start fully, and attach debugger after that if I need to.

Tom Pažourek
  • 9,582
  • 8
  • 66
  • 107