36

This one seems to be originated after upgrading from vs2015 to vs2017. The error is

Compiler Error Message: The compiler failed with error code -532462766.

Some notes..

  • It works great on localhost.
  • The target framework is 4.5.2
  • I removed and re-installed all the nuget packages

Whie tracing i have

ModuleName     AspNetInitializationExceptionModule
Notification   BEGIN_REQUEST
HttpStatus     500
HttpReason     Internal Server Error
HttpSubStatus  0
ErrorCode      The operation completed successfully.

And the full message is such

C:\Windows\SysWOW64\inetsrv>C:\Inetpub\vhosts\xxx\example.com\bin\roslyn\csc.exe /t:library /utf8output /nostdlib+ 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\6c18e943\c9225320_3eb1d201\Antlr3.Runtime.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e4a088a1\d00a7551_3eb1d201\Microsoft.AI.Agent.Intercept.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\cb16e378\ec642953_3eb1d201\Microsoft.AI.WindowsServer.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.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\3bcba04c\243c6d4f_3eb1d201\Microsoft.AI.DependencyCollector.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\44aabbe1\43688156_3eb1d201\Microsoft.AspNet.Identity.EntityFramework.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\c0b08566\baa93959_3eb1d201\Microsoft.Owin.Security.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\4ed695a8\d6318e55_3eb1d201\Microsoft.AspNet.Identity.Core.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_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e1faf943\7dc91593_3eb1d201\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\d06f7c29\f00a7a59_3eb1d201\Microsoft.Owin.Security.Facebook.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\72fa63a2\3e710999_3eb1d201\System.Web.Optimization.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\69efa965\80b6a15a_3eb1d201\Microsoft.Owin.Security.OAuth.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\b5b18ada\bafef257_3eb1d201\Microsoft.Owin.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.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\57f6acbf\bf5aa39d_3eb1d201\System.Web.WebPages.Razor.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_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\b18fe0f8\d27b8252_3eb1d201\Microsoft.AI.PerfCounterCollector.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\58d0af31\0bf4d912_7cb1d201\example.com.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\df149659\936bd959_3eb1d201\Microsoft.Owin.Security.Google.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\637d4f4f\aff16432_3eb1d201\EntityFramework.SqlServer.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\c43f3530\12875164_3eb1d201\PayPal.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http.WebRequest\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.WebRequest.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.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\8137658b\df0ddf58_3eb1d201\Microsoft.Owin.Security.Cookies.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\cc389662\6acf8b55_3eb1d201\Microsoft.ApplicationInsights.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\97f593a8\fcd60f60_3eb1d201\Newtonsoft.Json.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\822a23c0\69b8113a_3eb1d201\log4net.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\04f65f20\4100a85b_3eb1d201\Owin.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e0e14e11\24f0e756_3eb1d201\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\1b86b20b\543f309b_3eb1d201\System.Web.Razor.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\53a4612a\e06ea1ad_3eb1d201\WebGrease.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\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\4e98cd9b\ec546e56_3eb1d201\Microsoft.AspNet.Identity.Owin.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.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\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\06f3878a\e6344c99_3eb1d201\System.Web.Mvc.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\a4d4a537\d27b8252_3eb1d201\Microsoft.AI.ServerTelemetryChannel.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Web.Entity.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\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\00ff694d\c557ce4d_3eb1d201\EntityFramework.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.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\2de5dee5\150fa158_3eb1d201\Microsoft.Owin.Host.SystemWeb.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\a265bb71\f207155a_3eb1d201\Microsoft.Owin.Security.MicrosoftAccount.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\00534da5\ba17e25a_3eb1d201\Microsoft.Owin.Security.Twitter.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\d9fef609\fe73809c_3eb1d201\System.Web.WebPages.Deployment.dll" 
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\db1905dd\01e2289e_3eb1d201\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\3cda5a04\99511653_3eb1d201\Microsoft.AI.Web.dll" 
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.dll" 
/D:DEBUG /debug+ /optimize- /warnaserror- /w:4 /nowarn:1659;1699;1701;612;618 /langversion:6 /nowarn:1659;1699;1701  "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.1.cs"
OrElse
  • 9,709
  • 39
  • 140
  • 253

7 Answers7

67

And the winner is ASP.NET Dynamic Compilation

These lines in web.config where the cause. I only wish I knew how they got there. Was it a nu-get package or the VS2017 compilation?

Remove these lines to resolve this error:

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.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.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
MLavoie
  • 9,671
  • 41
  • 36
  • 56
OrElse
  • 9,709
  • 39
  • 140
  • 253
  • 3
    I'm guessing VS2017; I've never had this problem before. Thanks for the answer! – mrmichaeldev Jun 26 '17 at 22:54
  • 11
    Just to be clear for others... the solution is to delete the six lines shown here. – Matt Oct 21 '17 at 09:59
  • These lines appear after installing the `Microsoft.CodeDom.Providers.DotNetCompilerPlatform` NuGet package. – Rudey Dec 10 '17 at 10:02
  • 12
    -1 It's not a solution to delete a feature in order for the application to work. The better solution is to fix the problem and also keep the existing feature. See the answer below (deleting the bin folder). – Mladen B. Jan 19 '18 at 11:58
  • Removing this section only makes it revert to an older compiler and my code breaks on c# 5 syntax. For my issue, it was over-driving an Azure app service that ran out of RAM. Upgrading the service fixed my issue. – Chuck D Sep 19 '22 at 22:52
47

Deleting my bin folder fixed this for me, it occurred after switching branches which had different nuget packages in packages.config

Rich
  • 3,640
  • 3
  • 20
  • 24
7

If you remove this part, this may work. But it seems, that this can break your view-compilation. In my case, the null-conditional operator wont work. Solution was to update the .NET-Framework to 4.6.2 in my target system (dev-environment was on the newest, so I hadnt had this issue there).

FaustsErbe
  • 113
  • 4
  • 1
    This also broke "nameof" :( 4.6.2 isn't installed on my target server but going to try 4.6.1 – Tom Jul 12 '17 at 13:37
1

Updating to .NET-Framework to 4.6.2 on target server fixed this for me.

tobydodds
  • 37
  • 4
1

In my case, i'd accidentally configured a new project to use the current version 2.x.x of Microsoft.Net.Compilers where other projects in the solution were using version 1.0.0.

Sam Jones
  • 4,443
  • 2
  • 40
  • 45
1

I had this problem when introducing the Roslyn compiler to a Sharepoint project.

The first problem was Could not find a part of the path ... bin\roslyn\csc.exe, which was solved by copying csc.exe to the bin folder in the virtual directory for the site.

After that I got the problem with the error code -532462766, which was because it was missing the dll's specified in the csc.exe.config, so make sure to copy them as well from where you are copying the csc.exe, along with the rest of the files you find there.

Alex
  • 14,104
  • 11
  • 54
  • 77
0

i was having this while calling an .exe in afterbuild events in my project. The exe returned that error during the event.

i found out that my exe was calling "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\gacutil" with params from my project. but i was working on a new windows server, so the path was no longer the same (i was using version 7 instead of 10). I fixed that path to the right one, and the error was fixed.

It's weird, i would have expected a "path not found" error, not 532462766...

Sophie
  • 324
  • 3
  • 12