Currently I am developing a azure function. I use Net6.0. I have multiple imports. At least one with ftp and one with http.
So I imported both packages via nuget. But if I start my function, the following error occurs:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Http, Version=7.0.0.0, Culture=neutral, PublicKeyToken=...'. The system cannot find the file specified.'`
This error is thrown because of a dependency of FluentFTP
:
If I downgrade Microsoft.Extensions.Http
to Version 6.0.0. The application starts without any error. Or, if I remove the Microsoft.Extensions.Http
package, it also works (then the depency has version 2.2.0).
But why is this a problem with the newest version? Is there a way of using all packages with the newest version?
CodePudding user response:
You are targeting net6.0
and the Microsoft.Extensions.Http
dependency you are trying to install is meant for net7.0
.
You can check that versions are named according to the .net version - https://www.nuget.org/packages/Microsoft.Extensions.Http/7.0.0#versions-body-tab
That is why you should use Microsoft.Extensions.Http
version 6.0.0
or below.