Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies

前端 未结 25 2622
轻奢々
轻奢々 2020-11-28 22:52

I am using Visual Studio 2017 and am trying to create a .Net Standard 1.5 library and use it in a .Net 4.6.2 nUnit test project.

I am getting the following error...

25条回答
  •  借酒劲吻你
    2020-11-28 23:47

    I have also gone through this error and sharing how i got rid off to it.

    In my case below line existed in web.config of webapi project but there was not package reference in package.config file.

    Code in Web.config in Webapi Project

    
        
        
    
    

    Code I Added in packages.config file in web api project Before closing of element.

    
    

    Another Solution Worked in My Case:

    Another Sure short that may work in case you copied project to another Computer system that may have little different package versions that you can try changing assembly version to version given in error on website / webapi when you run it. Like in this case as given in question Version needed is '4.1.0.0' so simply try changing current version in web.config to version shown in error as below

    Error:

    Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies
    

提交回复
热议问题