title: Deploying MVC4 site to Azure results in ExtensionAttribute exception
body: <p>After watching the key note address from Scott Gu at AspConf I got excited about trying the Windows Azure Web sites with MVC4. I tried deploying an existing MVC application after re-configuring it to target .NET framework 4.0 instead of 4.5 and got the following error. </p>
  
  <blockquote>
    <p>Could not load type
    'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
    'mscorlib, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'.</p>
  </blockquote>
  
  <p>Since I had already added several NuGet packages I thought it might have something to do with Ninject so I created a new MVC project targeting the .NET 4.0 framework with no NuGet packages and deployed to Windows Azure using the Visual Studio 2012 RC Publish option (right-clicking the Web project) and I still get this error. </p>
  
  <p>Does anyone know what's going on or how to fix this issue? Thanks in advance.</p>
  
  <p>Including full stack trace:</p>
  
  <blockquote>
    <p>[TypeLoadException: Could not load type
    'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
    'mscorlib, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'.]<br>
    System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken,
    IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs,
    Int32 methodInstCount, ObjectHandleOnStack type) +0<br>
    System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module,
    Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext,
    RuntimeTypeHandle[] methodInstantiationContext) +180<br>
    System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,
    Type[] genericTypeArguments, Type[] genericMethodArguments) +192<br>
    System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord
    caRecord, MetadataImport scope, Assembly&amp; lastAptcaOkAssembly,
    RuntimeModule decoratedModule, MetadataToken decoratedToken,
    RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[]
    attributes, IList derivedAttributes, RuntimeType&amp; attributeType,
    IRuntimeMethodInfo&amp; ctor, Boolean&amp; ctorHasParameters, Boolean&amp;
    isVarArg) +115<br>
    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule
    decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount,
    RuntimeType attributeFilterType, Boolean mustBeInheritable, IList
    derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426 
    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly
    assembly, RuntimeType caType) +103<br>
    System.Reflection.RuntimeAssembly.GetCustomAttributes(Type
    attributeType, Boolean inherit) +64<br>
    WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly
    assembly) +64    WebActivator.ActivationManager.RunActivationMethods()
    +143    WebActivator.ActivationManager.Run() +22</p>
    
    <p>[InvalidOperationException: The pre-application start initialization
    method Run on type WebActivator.ActivationManager threw an exception
    with the following error message: Could not load type
    'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
    'mscorlib, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'..]<br>
    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1
    methods) +423<br>
    System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306<br>
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
    appManager, IApplicationHost appHost, IConfigMapPathFactory
    configMapPathFactory, HostingEnvironmentParameters hostingParameters,
    PolicyLevel policyLevel, Exception appDomainCreationException) +677</p>
    
    <p>[HttpException (0x80004005): The pre-application start initialization
    method Run on type WebActivator.ActivationManager threw an exception
    with the following error message: Could not load type
    'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
    'mscorlib, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'..]<br>
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090044 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
    wr, HttpContext context) +256</p>
  </blockquote>