1

Closed

OwinHost only scan assemblies if in /bin

description

I've found that if you have a library project with the necessary [assembly // OwinStartup] attribute OwinHost.exe only can find the entry-point if the output directory is "/bin" and not "/bin/<platform>". Therefore if your library compiles to /bin/debug it won't work.
C:\source\github\Simple.Web-https\src\OwinLibraryHost\bin\debug [katana2-owinhost-issue +0 ~11 -0]>..\..\..\packages\OwinHost.2.0.0-rc1-20711-450\tools\OwinHost.exe
Starting with the default port: 5000 (http://localhost:5000/)
Error:  System.EntryPointNotFoundException
  The following errors occurred while attempting to load the app.
 - No assembly found containing an OwinStartupAttribute.
C:\source\github\Simple.Web-https\src\OwinLibraryHost\bin\debug [katana2-owinhost-issue +0 ~11 -0]> mv *.* ..
C:\source\github\Simple.Web-https\src\OwinLibraryHost\bin\debug [katana2-owinhost-issue +0 ~11 -0]> cd ..
C:\source\github\Simple.Web-https\src\OwinLibraryHost\bin [katana2-owinhost-issue +0 ~11 -0]>..\..\packages\OwinHost.2.0.0-rc1-20711-450\tools\OwinHost.exe
Starting with the default port: 5000 (http://localhost:5000/)
Started successfully
Press Enter to exit

Terminating.
C:\source\github\Simple.Web-https\src\OwinLibraryHost\bin [katana2-owinhost-issue +0 ~11 -0]>
Closed Aug 19, 2013 at 5:16 PM by Tratcher

comments

Tratcher wrote Aug 15, 2013 at 5:42 PM

By design. OwinHost.exe is designed to work with web application project layouts where everything goes into the bin folder (no debug or release). If it tried to search the debug and release subdirectories it would end up finding a startup for both versions and not know which to launch.

ianbattersby wrote Aug 15, 2013 at 9:23 PM

Understood, but should the current directory have assemblies, including Microsoft.Owin.Hosting.dll (for OwinStartup), surely it's a safe bet just to execute there? Happy to submit a PR with an alternative flexible approach.

I did try to set the directory parameter at one point but didn't help either (to be confirmed).

Tratcher wrote Aug 15, 2013 at 10:55 PM

It can only be so flexible before you start hitting unintended side-effects. I think we're going to leave it as is for now.

brendonparker wrote May 15, 2014 at 2:47 PM

FWIW - I'd vote for the ability to configure the actual directory to look for assemblies without requiring a "bin" folder (as currently hard-coded).