I spend long time to try and seems find the solution:
1. Open Tools > Library Package Manager > Manage Nuget Packages For solution
and serach the word "data" shows:
2. As the error says Microsoft.Data.OData, Version=5.6.0.0" Could not load
, you can find that there's Microsoft.Data.OData
installed here, name OdataLib for OData v1-3
, but its version is 5.6.3 not 5.6.0.0
3. Hence now manage it and uncheck all project to uninstall it, but you'll meet the error Microsoft.AspNet.WebApi.OData 5.0.0 depends on it
, hence you should first uninstalled Microsoft.AspNet.WebApi.OData 5.0.0
4. Then Uninstall other three packages, their id are :
.
Microsoft.Data.OData
Microsoft.Data.Edm
System.Spatial
5. reinstall Microsoft.Data.OData -Version 5.6.0
https://www.nuget.org/packages/Microsoft.Data.OData/5.6.0
using Package Manager Console
Install-Package Microsoft.Data.OData -Version 5.6.0
then the three orange will be reinstall with ver 5.6.0.0
6. reinstall Microsoft.AspNet.WebApi.OData 5.0.0
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.OData/5.0.0
using Package Manager Console
Install-Package Microsoft.AspNet.WebApi.OData -Version 5.0.0
7. Then I can run the API without error