title: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib
body: <p>When starting up my web site for the first time, I'm getting this error</p>
  
  <p><code>Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'</code></p>
  
  <p>What am I doing wrong?</p>
  
  <p>I am using .NET 4 and am starting the site from Visual Studio.</p>
  
  <p>The only thing I've changed recently is add Simple Injector (via Nuget) into my project.</p>
  
  <p>Here's the stack trace</p>
  
  <pre class="lang-none prettyprint-override"><code>[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
     System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
     System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
     System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
     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
     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
     System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) +64
     WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +132
     WebActivator.ActivationManager.RunActivationMethods() +216
     WebActivator.ActivationManager.RunPreStartMethods() +43
     WebActivator.ActivationManager.Run() +69
  
  [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'..]
     System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423
     System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
     System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
  
  [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'..]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
     System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
  </code></pre>
  
  <p>The first line of all views get highlighted and when you hover over them you get this error</p>
  
  <pre class="lang-none prettyprint-override"><code>The pre-application start initialisation 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'.
  </code></pre>