Search code examples
msbuildasp.net-coreasp.net-core-mvcdnxdnu

ASP.NET 5: Where are my output DLLs when publishing?


Where are my output DLLs when publishing an ASP.NET 5 web application?

When running the MSBuild's FileSystemPublish, the publish directory looks something like this:

  • approot folder: packages, runtime and source code
  • wwwroot folder: web.config and AspNet.Loader.dll
  • web
  • web.cmd

MSBuild.exe "C:/MyApplication/MyProj.xproj" /t:Build,FileSystemPublish /p:PublishConfiguration=Release /p:PublishOutputPathNoTrailingSlash="C:/a/MyApplication"

From the logging output I can see that dnu publish is called:

dnu publish "C:/MyApplication" --out "C:/a/MyApplication" --configuration Release --runtime dnx-clr-win-x86.1.0.0-beta6 --quiet

If I look inside web.cmd I can see that DNX is indeed running the application from source code:

@"%~dp0approot\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnx.exe" --appbase "%~dp0approot\src\MyApplication" Microsoft.Framework.ApplicationHost web %*

I am able to point IIS to the wwwroot directory with success.

How does IIS know to call on web.cmd? Is this the correct approach to serving up an ASP.NET 5 application in a production environment?


Solution

    1. IIS doesn't call web.cmd. IIS knows how to load AspNet.Loader from the wwwroot folder.
    2. In a production environment you probably don't want to compile from sources because the startup is pretty slow. You should publish precompiled binaries. You do that by passing --no-source to dnu publish:

    dnu publish "C:/MyApplication" --out "C:/a/MyApplication" --configuration Release --runtime dnx-clr-win-x86.1.0.0-beta6 --no-source