From 736e6bee2ba5ab5ed5d8da49f68d698e4f077369 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 15 Jun 2015 11:11:08 -0700 Subject: [PATCH] #233 Create the wwwroot directory if it doesn't exist. --- src/Microsoft.AspNet.Hosting/HostingEnvironmentExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Microsoft.AspNet.Hosting/HostingEnvironmentExtensions.cs b/src/Microsoft.AspNet.Hosting/HostingEnvironmentExtensions.cs index a6cd1d5abf..98a839afdc 100644 --- a/src/Microsoft.AspNet.Hosting/HostingEnvironmentExtensions.cs +++ b/src/Microsoft.AspNet.Hosting/HostingEnvironmentExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.IO; using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.Hosting.Internal; @@ -11,6 +12,10 @@ namespace Microsoft.AspNet.Hosting public static void Initialize(this IHostingEnvironment hostingEnvironment, string applicationBasePath, string environmentName) { hostingEnvironment.WebRootPath = HostingUtilities.GetWebRoot(applicationBasePath); + if (!Directory.Exists(hostingEnvironment.WebRootPath)) + { + Directory.CreateDirectory(hostingEnvironment.WebRootPath); + } hostingEnvironment.WebRootFileProvider = new PhysicalFileProvider(hostingEnvironment.WebRootPath); hostingEnvironment.EnvironmentName = environmentName ?? hostingEnvironment.EnvironmentName; }