To solve the problem, I originally guess System.Runtime.dll
should be in .NET Framework Dll Folder
, because in Nuget Page of this dll, the version history doesn't contains 4.2.1.0
, but after reading @Scircia answer, I try to add the latest Nuget System.Runtime.dll
to the project by Right Click On Project > Property Page > References > Add
. the Nuget version of the dll is 4.3.1
, but its dll version is 4.6.27406.3
.
After Adding, a new error show:
Assembly 'XXXX(It's secret), Version=x.x.x.x, Culture=neutral, PublicKeyToken=xx' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
But the dll I add is 4.6.27406.3
, why got this 4.0.0.0
error? After some try, I finally find the main cause is, in the project many component use .NET Framework 3.5
so it should be run at 3.5
, but when I Right Click On Project > Property Page > Build > Target Framework
, it shows currently use 4.0
.
So I follow these step to change the Target Framework from 4.0
to 3.5
Click OK, then again from 3.5
to 4.0
, then the error is solved. That is, through 4.0 > 3.5 > 4.0
, the web.config is auto modifed and seems some dll that need 3.5
is removed, become a real 4.0
, and in Framework 4.0
the System.Runtime.dll
works good.
Since it says need 4.2.1.0
, but I add 4.6.27406.3
works, so I suppose that use a higer version than 4.2.1.0
is allowed, not need to use exactly 4.2.1.0
.
But another point is, since the project need to run at 3.5
to make the Web UI package works, after changing to 4.0
, some of the UI control lost function.
So I conclude that the XXXX(It's secret).dll
should not be use in the .NET Framework 3.5
project.
Besides I use Resharper to see the XXXX.dll
shows that it's .NETCoreApp
.