My web project use .NET Framework 4.7.2
and use some references like
System.IO
System.Net
System.Net.Http
System.Net.Http.Formatting
My project works perfectly in local.
However, when I publish my web project on a target directory (for online), and look what it contains in /bin/
:
System.IO
is missingSystem.Net
is presentSystem.Net.Http
is missingSystem.Net.Http.Formatting
is present
Therefore, when I use my website, I get the obvious error Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
All references have Copy Local = True
in Properties
but some dll are always ignored. If i copy the dlls from local directory to target directory i get the error Server Error in '/' Application. Cannot load a reference assembly for execution. Exception Details: System.BadImageFormatException: Cannot load a reference assembly for execution.
Exactly the same problem as this one.
However the delete/rebuild solution, or adding compilation options solution, doesn't work for me
What do I need to do to get these missing dlls to the destination folder?