0

I have two projects in my solution.

ProjectA is a windows service, and ProjectB has a reference to Microsoft.Owin.Host.HttpListener, which starts a WebApi as self-host.

The reason why those projects are seperated, is to be able to share ProjectB across other windows services.

If I set ProjectA as startup, which then references to ProjectB, at the moment ProjectB tries to interact with any WebApi functionality (from the Microsoft.Owin.Host.HttpListener namespace), it will throw an exception, telling me that:

An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.Owin.Hosting.dll

Additional information: The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener

Is it possible to have the ProjectB executing it's own external references, when ProjectA is the executing point, without installing Owin.HttpListener package in ProjectA as well? And if so, how?

Community
  • 1
  • 1
grmihel
  • 784
  • 3
  • 15
  • 40
  • 1
    The answer is - it depends. see [this discussion](https://stackoverflow.com/questions/15816769/dependent-dll-is-not-getting-copied-to-the-build-output-folder-in-visual-studio) – Tewr Oct 09 '17 at 11:49
  • 1
    It sounds like you have some (business) logic inside ProjectB, which also contains a WebAPI. Why not add a ProjectC and add the logic over there, so both ProjectA and ProjectB can use this without relying on some 'weird' references. This way each project has its own responsibility. Of course, you might have a valid reason why you have set the projects up like this, but it appears a bit strange at the moment. – Jan_V Oct 09 '17 at 11:57
  • @Jan_V The issue will just persist to another project in that solution. The issue here is, that the executing project, does not have the same nuget package, as the one that projectB is using. – grmihel Oct 09 '17 at 12:01
  • Seems to me that the solution is adding Costura.Fody (https://github.com/Fody/Costura#how-it-works-link) nuge package to ProjectB, which would handle the reference resources that ProjectB is dependent on, without installing them in the executing (ProjectA) project. – grmihel Oct 09 '17 at 12:07

0 Answers0