From dcd203503e980717e626cb2c5bfcfbebc5657a6f Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 10 Mar 2016 15:10:45 -0800 Subject: [PATCH] cleanup --- src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs index 2571c73f..e25daa61 100644 --- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs +++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs @@ -225,16 +225,18 @@ private string ResolveApplicationBasePath(string applicationBasePath, string bas { if (_startup != null) { - var startupAssemblyLocation = Path.GetDirectoryName(_startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.Location); - if (startupAssemblyLocation != null) { - return startupAssemblyLocation; + var startupAssemblyLocation = _startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.Location; + if (!string.IsNullOrEmpty(startupAssemblyLocation)) + { + return Path.GetDirectoryName(startupAssemblyLocation); } } else if (_startupType != null) { - var startupAssemblyLocation = Path.GetDirectoryName(_startupType.GetTypeInfo().Assembly.Location); - if (startupAssemblyLocation != null) { - return startupAssemblyLocation; + var startupAssemblyLocation = _startupType.GetTypeInfo().Assembly.Location; + if (!string.IsNullOrEmpty(startupAssemblyLocation)) + { + return Path.GetDirectoryName(startupAssemblyLocation); } }