0

After publishing my asp.net MVC 5 website to the hosting environment, I got the following error message

Compilation Error - The compiler failed with error code 1

Nothing else besides the compiler-call itself is shown.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
HCL
  • 36,053
  • 27
  • 163
  • 213

3 Answers3

7

In my case, the MVC-templates added the following section in the web.config file:

<system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.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.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>

After removing them, everything worked as expected.

HCL
  • 36,053
  • 27
  • 163
  • 213
  • 1
    Thanks it resolved my issue as well, I was getting The compiler failed with error code -532462766. but can you or anyone explain why it was happening – Sushant Baweja Feb 13 '18 at 06:20
2

Restarting the server , solved the issue for me.

Menzi
  • 328
  • 2
  • 12
0

There may be framework Issue change the framework to latest version. This will solved issue.