Can't load System.Web.Cors assembly after call to Microsoft.Owin.Cors

前端 未结 2 1251
不思量自难忘°
不思量自难忘° 2020-12-05 14:52

When I check the System.Web.Cors assembly reference in the Solution Explorer, the Version is 5.2.3.0. The Specific Version

相关标签:
2条回答
  • 2020-12-05 15:18

    run this command into PM (package manager)

    Install-Package Microsoft.AspNet.Cors -Version 5.2.3.0

    0 讨论(0)
  • 2020-12-05 15:24

    Turns out System.Web.Cors.dll does not come from the Microsoft.AspNet.WebApi.Cors package. It comes from the Microsoft.AspNet.Cors package.

    Install-Package Microsoft.AspNet.Cors -Version 5.0.0
    

    This resolved the immediate error.

    In case you have a scenario in which you need two different versions of the System.Web.Cors.dll, I'd suggest this solution:

    1. Using the Package Manager, change the version of Microsoft.AspNet.Cors to the version that Microsoft.Owin.Cors requests in its manifest definition.
    2. Using the Developer Command Prompt for Visual Studio (run as admin), navigate to the package folder for the newly versioned Microsoft.AspNet.Cors where the *System.Web.Cors.dll** resides.
    3. Run the following command: gacutil -i System.Web.Cors.dll.
    4. Go back to the Package Manager and change Microsoft.AspNet.Cors back to the version you originally wanted.

    This method simply pulls the desired version of the .dll file into your Solution's packages folder. Then you use gacutil.exe to add this version of the .dll to your Global Assembly Cache. Visual Studio probes for the desired .dll versions first in the GAC, then in your local project.

    0 讨论(0)
提交回复
热议问题