Charles Okwuagwu
Charles Okwuagwu

Reputation: 10876

Another Strange ASP.net Error: The compiler failed with error code 255

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"

Upvotes: 17

Views: 47142

Answers (12)

Michael Bray
Michael Bray

Reputation: 15265

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

Upvotes: 1

Fiach Reid
Fiach Reid

Reputation: 7059

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

Upvotes: 2

Tom Pažourek
Tom Pažourek

Reputation: 10167

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.

Upvotes: 0

Meer
Meer

Reputation: 686

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>

Upvotes: 51

alv
alv

Reputation: 1097

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.

Upvotes: 9

Eyal
Eyal

Reputation: 4763

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

Upvotes: 0

Siyavash Hamdi
Siyavash Hamdi

Reputation: 3087

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.

Upvotes: 1

Web Developer India
Web Developer India

Reputation: 677

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

Upvotes: 5

Ganesh
Ganesh

Reputation: 179

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.

Upvotes: 14

Bartek KG
Bartek KG

Reputation: 41

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..

Upvotes: 1

Vishnu
Vishnu

Reputation: 2177

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

Upvotes: 2

deathgore
deathgore

Reputation: 71

Moving project to .net 4.6.1 helps as well.

Upvotes: 6

Related Questions