Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib

前端 未结 10 526
悲哀的现实
悲哀的现实 2020-11-22 14:25

When starting up my web site for the first time, I\'m getting this error

Could not load type \'System.Runtime.CompilerServices.ExtensionAttribute\' from assemb

10条回答
  •  孤街浪徒
    2020-11-22 14:49

    I had this exact same problem with a site (Kentico CMS), starting development in 4.5, finding out the production server only supports 4.0, tried going back down to target framework of 4.0. Compiling the other posts in this thread (specifically changing target framework to .Net 4 and .Net 4.5 still being referenced). I searched through my solution and found that a handful of the NuGet packages were still using libraries with targetFramework="net45".

    packages.config (before):
    
    
      
      
      
      
    
    

    I changed the projects target framework back to 4.5, removed all NuGet libraries, went back down to 4.0 and re-added the libraries (had to use some previous versions that were not dependent on 4.5).

    packages.config (after):
    
    
      
      
      
      
      
    
    

提交回复
热议问题