I have an application that has a NuGet reference to System.Net.Http (among, obviously, many other references).
When I build a package of this application using "Publish", and selecting the "from CD" option, it compiles the installation into a local folder, with all the binaries packed into .deploy files. All, that is, except System.Net.Http.dll.
I have tried many different workarounds, changing the properties of the System.Net.Http reference in the project, then removing the NuGet reference and adding it instead as an Assembly reference from the .NET Framework. Nothing doing. This particular DLL seems to be uniquely resistant to being packaged along with the rest of the binaries.
If it makes any difference, I'm working with .NET Framework 4.6.2.
Why is this behavior happening? How to fix it?
UPDATE:
Based on the comments below I investigated Project Properties > Publish > Application Files. System.Net.Http.dll was not listed among the options. So I hacked it by changing the "Publish Status" of System.Net.Http.Extensions.dll to "Include" (instead of "Include (Auto)"), which added a section to my project file, which I then edited to remove the ".Extensions", thus:
<ItemGroup>
<PublishFile Include="System.Net.Http">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
</ItemGroup>
Now my project application files list contains System.Net.Http... sort of:

Well, clearly something is very confused here. System.Net.Http is simultaneously referenced and not referenced. And when I publish, even though I have explicitly included it, System.Net.Http.dll is still not published.
in project properties of your project is publish and at there is a button (application Files) at there you choose with files be include or exclude go there and include dlls need project if it not work add dll like exist file and make it copy always it will work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With