I am referencing a one project in Visual Studio solution from another project in the same solution. The project being referenced (Project B) has Microsoft.Owin.Host.HttpListener nuget package and so the .dll referenced in it. The project that is referencing project B (Project A) is being built. The output folder gets all those dlls referenced in Project B, except Microsoft.Owin.Host.HttpListener.dll even though it is marked as Copy Local - true.
The Microsoft.Owin.Host.HttpListener.dll is the only one that I've faced so far that refuses to be copied to the Project A's build output as a part of MSBuild's _CopyFilesMarkedCopyLocal step regardless of the settings.
I've tried to add it to a entries in app.config, it didn't help.
I've arranged the sample project showcasing the referencing problem and uploaded it to GitHub here.
You are free to play with the settings.
I've check out the related questions in Stackoverflow before asking this and they are not answered or unrelated.
Please give me a hint how to get the .HttpListener.dll to be copied along with other .dlls to a referencing projects output as expected.
With the help of my team members I was able to get to the root of the problem. Compiler was omitting HttpListener dll as it wasn't being used anywhere in code of Project A or B explicitly. Thus I've added the following line to Project B's code:
//Dummy line to bypass the optimization.
Trace.TraceInformation(typeof(Microsoft.Owin.Host.HttpListener.OwinHttpListener).FullName);
This created an actual dependency on HttpListener.dll and it started to be included in Project A's output.