3.7 KiB
title | author | description | manager | ms.author | ms.custom | ms.date | ms.prod | ms.technology | ms.topic | uid |
---|---|---|---|---|---|---|---|---|---|---|
ASP.NET Core directory structure | guardrex | Learn about the directory structure of published ASP.NET Core apps. | wpickett | riande | mvc | 04/09/2018 | asp.net-core | aspnet | article | host-and-deploy/directory-structure |
ASP.NET Core directory structure
By Luke Latham
In ASP.NET Core, the published application directory, publish, is comprised of application files, config files, static assets, packages, and the runtime (for self-contained deployments).
App Type | Directory Structure |
---|---|
Framework-dependent Deployment |
|
Self-contained Deployment |
|
†Indicates a directory
The publish directory represents the content root path, also called the application base path, of the deployment. Whatever name is given to the publish directory of the deployed app on the server, its location serves as the server's physical path to the hosted app.
The wwwroot directory, if present, only contains static assets.
The stdout logs directory can be created for the deployment using one of the following two approaches:
-
Add the following
<Target>
element to the project file:<Target Name="CreateLogsFolder" AfterTargets="Publish"> <MakeDir Directories="$(PublishDir)Logs" Condition="!Exists('$(PublishDir)Logs')" /> <WriteLinesToFile File="$(PublishDir)Logs\.log" Lines="Generated file" Overwrite="True" Condition="!Exists('$(PublishDir)Logs\.log')" /> </Target>
The
<MakeDir>
element creates an empty Logs folder in the published output. The element uses thePublishDir
property to determine the target location for creating the folder. Several deployment methods, such as Web Deploy, skip empty folders during deployment. The<WriteLinesToFile>
element generates a file in the Logs folder, which guarantees deployment of the folder to the server. Note that folder creation may still fail if the worker process doesn't have write access to the target folder. -
Physically create the Logs directory on the server in the deployment.
The deployment directory requires Read/Execute permissions. The Logs directory requires Read/Write permissions. Additional directories where files are written require Read/Write permissions.