Feel like Hell-Fighter: Could not load file or assembly 'System.Web.Cors, Version=5.0.0.0

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Do you know some of these exceptions? I’m sure you do. In last years we are becoming more and more “cool” web technologies. But I have a feeling that productivity is in some cases rolled back to the 1998-2001.
15+ years ago we deled with a term called “DLL-hell”. And we fixed the hell, but new hells were born like assembly hell, gac-hell etc. Right now I’m fighting with NUGET-Hell. Sometimes I feel like a Hell-Fighter.

Here is one of my combats. You definitely know the feeling: You press F5 and boom:

image

I will not even try to describe the reason for this. But here is a workaround. The missing assembly is really missing, because somebody has probably forgotten to include it in some package (guess: Microsoft.AspNet.WebApi.Cors).
But good thing in the old version of that package, this assembly was included.

So, add a nuget reference to Microsoft.AspNet.WebApi.Cors 5.0.0. If it does not work, you will have to manuall add a reference to : \packages\Microsoft.AspNet.WebApi.Cors.5.0.0\lib\net45\System.Web.Http.Cors.dll.

You can also add it to GAC, but I wouldn’t recommend this, because at same later time, this will came back to you as new issue.

And I also have this in my web.config:

<dependentAssembly>
       <assemblyIdentity name="System.Web.Http.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
       <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
     </dependentAssembly>


Posted Jun 20 2016, 12:03 PM by Damir Dobric
Filed under:
developers.de is a .Net Community Blog powered by daenet GmbH.